Beispiel #1
0
    public override void Move()
    {
        playerPos = GameObject.Find("Player").GetComponent <Rigidbody>().position;

        if (this.transform.position.x <= -camW / 6f && state == motionState.first)
        {
            state = motionState.second;
            this.enemyRigid.velocity = new Vector3(speed, 0f, 0f);
        }
        if (state == motionState.second)
        {
            if (this.transform.position.y <= playerPos.y + 0.5f && this.transform.position.y >= playerPos.y - 0.5f)
            {
                state = motionState.third;
                this.enemyRigid.velocity = new Vector3(speed * 1.5f, 0f, 0f);
            }
            else if (this.transform.position.y <= playerPos.y)
            {
                this.enemyRigid.velocity = new Vector3(1f, 2f, 0f).normalized *speed;
            }
            else if (this.transform.position.y >= playerPos.y)
            {
                this.enemyRigid.velocity = new Vector3(1f, -2f, 0f).normalized *speed;
            }
        }
    }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (motion >= motionThreshold)
     {
         m_motionS = motionState.Angry;
     }
     else if (motion <= -1 * motionThreshold)
     {
         m_motionS = motionState.Sad;
     }
     MotionMod();
 }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     m_motionS = motionState.None;
 }
Beispiel #4
0
 return(new MotionStateNativeView(motionState, offset));