コード例 #1
0
ファイル: AIHand.cs プロジェクト: dany1532/Social_Clues
    public void FollowEnemy(Enemy_Minigame enemy)
    {
        if(handAIState == HandAIState.NONE)
        {

            enemyToFire = enemy;
            handAIState = HandAIState.FOLLOWING;
        }
    }
コード例 #2
0
ファイル: AIHand.cs プロジェクト: dany1532/Social_Clues
 public void FollowTreasure(Pirate_Treasure treasure)
 {
     if(treasureToFollow == null){
         treasureToFollow = treasure;
         handAIState = HandAIState.FOLLOWING;
     }
 }
コード例 #3
0
ファイル: AIHand.cs プロジェクト: dany1532/Social_Clues
    void Start()
    {
        //myHandType = TypeHand.TREASURE;

        handAIState = HandAIState.NONE;
    }
コード例 #4
0
ファイル: AIHand.cs プロジェクト: dany1532/Social_Clues
    void EnemyAIUpdate()
    {
        if(myHandType == TypeHand.ENEMY)
        {
            //if(!GetComponent<UITexture>().enabled) { GetComponent<UITexture>().enabled = true; }

            if(handAIState == HandAIState.FOLLOWING)
            {
                float dist = Vector2.Distance ((Vector2) ship.transform.position,
                                (Vector2)enemyToFire.transform.position);

                Vector3 enemyPos = enemyToFire.transform.position;
                if(dist > 0.75f)
                    enemyPos.y -= 0.25f;

                Vector3 dir = enemyPos - transform.position;
                dir.Normalize();
                transform.Translate(new Vector3(dir.x, dir.y, 0) * handSpeed * Time.deltaTime);

                if(!reachedDestination && Vector2.Distance ((Vector2) transform.position, (Vector2)enemyPos) < 0.1f)
                {
                    reachedDestination = true;

                    if(dist < 0.75f)
                    {
                        ship.ShootAtPosition(enemyToFire.transform.position);
                    }

                    else{
                        ship.ShootAtPosition(enemyPos);
                    }

                    handAIState = HandAIState.PRESSING;
                    //treasureToFollow.TreasurePressed(true);
                    //if(!GetComponent<UITexture>().enabled) { GetComponent<UITexture>().enabled = true; }
                    GetComponent<UITexture>().enabled = true;
                    GetComponent<UITexture>().mainTexture = selectHandTexture;
                    Invoke("UnpressEnemy", 0.5f);
                }
            }
        }
    }
コード例 #5
0
ファイル: AIHand.cs プロジェクト: dany1532/Social_Clues
 public void UnselectTreasure()
 {
     GetComponent<UITexture>().mainTexture = unselectHandTexture;
     GetComponent<UITexture>().enabled = false;
     handAIState = HandAIState.NONE;
     reachedDestination = false;
     treasureToFollow = null;
 }
コード例 #6
0
ファイル: AIHand.cs プロジェクト: dany1532/Social_Clues
 public void UnpressEnemy()
 {
     GetComponent<UITexture>().enabled = false;
     GetComponent<UITexture>().mainTexture = unselectHandTexture;
     reachedDestination = false;
     enemyToFire = null;
     handAIState = HandAIState.NONE;
 }