Snippets Collections
export JAVA_HOME=/Users/kenmiya/workspace/Unity/2021.1.1f1/PlaybackEngines/AndroidPlayer/OpenJDK/jre
echo $JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
echo $PATH
    public float movementSpeed;

    public Rigidbody2D rb;



    float mx;



    private void Update()
    {

        mx = Input.GetAxisRaw("Horizontal");

    }



    private void FixedUpdate()
    {

        Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);



        rb.velocity = movement;



    }
if (isExplosion) {
    foreach (GameObject enemy in units) {
        float distanceToEnemy = Vector3.Distance (transform.position, enemy.transform.position);
        if (distanceToEnemy <= explosionRadius) {
            Unit unit = enemy.GetComponent<Unit> ();
            float proximity = (transform.position - enemy.transform.position).magnitude;
            float effect = 1 - (proximity / explosionRadius);
            unit.TakeDamage ((int) (damage * effect));
            if (enemy.GetComponent<Setup> ().currentHealth <= 0) {
                GameObject explosionDestroy = Instantiate (enemy.GetComponent<Setup> ().explosionDestroy, enemy.transform.position, Quaternion.identity);
                Destroy (explosionDestroy, 1);
                Destroy (enemy);
            }
        }
    }
}
star

Sun Jun 20 2021 02:03:51 GMT+0000 (UTC)

#shell #unity

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension