Esempio n. 1
0
    void Update()
    {
        float hor = Input.GetAxis("Horizontal");
        float ver = Input.GetAxis("Vertical");

        if (m_MoveTrait && (hor != 0 || ver != 0))
        {
            m_MoveTrait.Move(hor, ver, 10);
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (m_FaceTargetTrait)
        {
            m_FaceTargetTrait.SetDirection(m_Target.position);
        }

        if (m_MoveTrait)
        {
            m_MoveTrait.Move(maxSpeed, accelerationTime, new Vector2(0, 1), true);
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (m_MoveTrait)
        {
            m_MoveTrait.Move(maxSpeed, accelerationTime, new Vector2(0, 1f), true);
        }

        RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.up, .1f, collisionMask);

        if (hit)
        {
            KillableTrait killable = hit.transform.GetComponent <KillableTrait>();

            if (killable)
            {
                killable.Damage(damage);
            }

            Die();
        }
    }