示例#1
0
    void DisablePlayers()
    {
        OpponentAI ai = FindObjectOfType <OpponentAI>();

        if (ai != null)
        {
            // add cards not played
            for (int i = 0; i < ai.hand_types.Length; ++i)
            {
                if (ai.hand_types[i] != CardType.None)
                {
                    ai.deck.AddToDeck(ai.hand_types[i], 1);
                }
            }
            ai.enabled = false;
        }
        PlayerHand[] hands = FindObjectsOfType <PlayerHand>();
        foreach (PlayerHand hand in hands)
        {
            CardPlayable[] cards = hand.cards;
            // add card to deck for saving
            AddUnplayedCardsToDeck(hand.GetDeck(), cards);
            // disable cards
            for (int i = 0; i < cards.Length; ++i)
            {
                cards[i].enabled = false;
            }
        }
    }
示例#2
0
    //private AdMobPlugin admob;

    void Start()
    {
        PlayerPrefs.SetInt("adCycle", 2);

        AudioSource.PlayClipAtPoint(AppStartSound, transform.position);

        Advertisement.Initialize("50134");

        if (Application.loadedLevel == 0)
        {
            PlayGamesPlatform.Activate();
            Social.localUser.Authenticate((bool success) => {
                if (success)
                {
                    //Debug.Log("Succesful Login");
                    GooglePlayIcon.GetComponent <SpriteRenderer>().sprite = (Sprite)Resources.Load("games_achievements_green", typeof(Sprite)) as Sprite;
                }
                else
                {
                    //Debug.Log("Login Fail");
                }
            });

            determinePipSpinAd();
        }

        gameManager = FindObjectOfType <GameManager> ();
        //MenuSprite = FindObjectOfType<MenuSprite> ();
        //pinPongLogo = FindObjectOfType<PinPongLogo> ();
        //pinPongTitle = FindObjectOfType<PinPongTitle> ();
        opponent = FindObjectOfType <OpponentAI> ();
    }
示例#3
0
文件: OpponentAI.cs 项目: ozata/Pisti
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
示例#4
0
    IEnumerator Attack(Transform obj)
    {
        anim.SetBool("Walk", false);
        isAttacking = true;
        anim.SetBool("isAttacking", isAttacking);
        StopAgent();

        if (obj.gameObject.tag == "Skeleton")
        {
            SkeletonAI skeleton = obj.GetComponent <SkeletonAI>();

            while (skeleton.isDeath == false && HasTargetReached(skeleton.transform) == true)
            {
                anim.SetTrigger("Attack");
                yield return(new WaitForSeconds(attackSpeed));

                StartCoroutine(skeleton.HitDamage(currentDamage));
            }
        }
        else if (obj.gameObject.tag == "Player")
        {
            PlayerController player = obj.GetComponent <PlayerController>();

            while (player.isDeath == false && HasTargetReached(player.transform) == true)
            {
                anim.SetTrigger("Attack");
                yield return(new WaitForSeconds(attackSpeed));

                StartCoroutine(player.HitDamage(currentDamage));
            }
        }
        else if (obj.gameObject.tag == "Opponent")
        {
            OpponentAI opponent = obj.GetComponent <OpponentAI>();

            while (opponent.isDeath == false && HasTargetReached(opponent.transform) == true)
            {
                anim.SetTrigger("Attack");
                yield return(new WaitForSeconds(attackSpeed));

                StartCoroutine(opponent.HitDamage(currentDamage));
            }
        }

        isAttacking = false;
        anim.SetBool("isAttacking", isAttacking);
        ReleaseAgent();
    }
示例#5
0
    new private void Start()
    {
        save_filepath = GameSettings.INSTANCE.tuto_battle_savename;
        base.Start();

        Assert.IsTrue(menu != null);
        player_init_hitpoints   = menu.playerHitPoints[0].hit_points;
        opponent_init_hitpoints = menu.playerHitPoints[1].hit_points;

        string tip_name = tips[current_tip].gameObject.name;

        // disable opponent ai
        if (tip_name == "Tip_hand")
        {
            OpponentAI ai = menu.decks[1].GetComponent <OpponentAI>();
            ai.enabled = false;
            menu.useEndGameCheckTime = false;
        }
    }
示例#6
0
    new void Update()
    {
        base.Update();

        // HARDCODED INPUT CHECK
        string tip_name = tips[current_tip].gameObject.name;

        if (tip_name == "Tip_hand")
        {
            if (DealPlayerDamage.totalTroopCount > 0)
            {
                NextTip();
                // enable opponent ai
                OpponentAI ai = FindObjectOfType <OpponentAI>();
                ai.enabled = true;
                menu.useEndGameCheckTime = true;
            }
        }
        else if (tip_name == "Tip_any_cards")
        {
            if (player_init_hitpoints > menu.playerHitPoints[0].hit_points)
            {
                NextTip();  // player damage
            }
            else if (opponent_init_hitpoints > menu.playerHitPoints[1].hit_points)
            {
                NextTip(); // opponent damage
            }
        }
        else if (tip_name == "Tip_damage_taken")
        {
            if (menu.IsBattleEnd())
            {
                ShowTip(5);
            }
        }
    }
示例#7
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        isGameFinished = true;

        GameObject[] allFlowersObjs = GameObject.FindGameObjectsWithTag("Flower");
        foreach (var flower in allFlowersObjs)
        {
            allFlowers.Add(flower.GetComponent <FlowerManager>());
        }

        GameObject[] allGravesObjs = GameObject.FindGameObjectsWithTag("Grave");
        foreach (var grave in allGravesObjs)
        {
            allGraves.Add(grave.GetComponent <GraveManager>());
        }

        player   = GameObject.Find("Player").GetComponent <PlayerController>();
        opponent = GameObject.Find("Opponent").GetComponent <OpponentAI>();
    }
示例#8
0
 public void Awake()
 {
     opponent = FindObjectOfType <OpponentAI> ();
 }