コード例 #1
0
 private void getManagerComponents()
 {
     mapper = GameObject.Find("ChunkManager").GetComponent<MapGenerator>();
     player = GameObject.Find("Player").GetComponent<Player>();
     trapper = GameObject.Find("TrapSpawner").GetComponent<TrapSpawner>();
     scoreText = GameObject.Find("Canvas").GetComponentInChildren<Text>();
 }
コード例 #2
0
 void Awake()
 {
     if (trapSpawner == null)
     {
         trapSpawner = this;
     }
 }
コード例 #3
0
ファイル: TrapActions.cs プロジェクト: poup/ankagaja
        private static void HurnAndContinue(TrapSpawner spawner, GameObject triggered, Collider2D triggerer)
        {
            var player = triggerer.GetComponent <PlayerController>();

            if (player != null)
            {
                CoroutineManager.Instance.StartCoroutine(Kill(player));
            }
        }
コード例 #4
0
ファイル: TrapActions.cs プロジェクト: poup/ankagaja
        private static void LootAndDisapear(TrapSpawner spawner, GameObject triggered, Collider2D triggerer)
        {
            var playerController = triggerer.transform.GetComponent <PlayerController>();
            var lootInfo         = triggered.GetComponent <Loot>();

            if (playerController && lootInfo)
            {
                playerController.AddReward(lootInfo.value);
                //StartCoroutine(AutoDestroy());
            }
        }
コード例 #5
0
ファイル: TrapActions.cs プロジェクト: poup/ankagaja
        private static void HurtAndDisapear(TrapSpawner spawner, GameObject triggered, Collider2D triggerer)
        {
            var player = triggerer.GetComponent <PlayerController>();

            if (player != null)
            {
                CoroutineManager.Instance.StartCoroutine(Kill(player));
            }
            else
            {
                GameObject.Destroy(triggered.gameObject);
            }
        }
コード例 #6
0
 private void StopGame()
 {
     gameRunnning = false;
     gameSpeed    = 0f;
     ts           = FindObjectOfType <TrapSpawner>();
     ts.StopSpawning();
     player.StopPlayer();
     monster.StopMonster();
     if (points > highscore)
     {
         PlayerPrefs.SetInt("highscore", points);
         highscoreText.text = "New highscore!";
     }
     else
     {
         highscoreText.text = "";
     }
     endScoreText.text = "Score\n" + points.ToString();
     PlayerPrefs.SetInt("lastScore", points);
     gameOverPanel.SetActive(true);
 }
コード例 #7
0
ファイル: TrapActions.cs プロジェクト: poup/ankagaja
        public static void DoAction(TrapSpawner spawner, TrapActionsType action, GameObject triggered, Collider2D triggerer)
        {
            switch (action)
            {
            case TrapActionsType.None:
                break;

            case TrapActionsType.HurtAndDisapear:
                HurtAndDisapear(spawner, triggered, triggerer);
                break;

            case TrapActionsType.HurnAndContinue:
                HurnAndContinue(spawner, triggered, triggerer);
                break;

            case TrapActionsType.LootAndDisapear:
                LootAndDisapear(spawner, triggered, triggerer);
                break;

            default:
                throw new ArgumentOutOfRangeException("action", action, null);
            }
        }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        coreBlinkAnimation = GetComponentInChildren <BlinkDamageAnimation> ();
        currentHealth      = maxHealth;
        difficulty         = 0;

        wanderBehavior = GetComponent <WanderBehavior> ();
        wanderBehavior.setActive(true);
        followBehavior = GetComponent <FollowBehavior> ();
        wanderBehavior.setActive(false);

        shieldSpawner  = GetComponentInChildren <ShieldSpawner> ();
        gunSpawner     = GetComponentInChildren <GunSpawner> ();
        wallGunSpawner = GetComponentInChildren <WallGunSpawner> ();
        targetFire     = GetComponent <TargettedFireBehavior> ();
        trapSpawner    = GetComponentInChildren <TrapSpawner> ();

        nextBehaviorStartTime = Time.time + behaviorDelay;
        nextBehaviorEndTime   = nextBehaviorStartTime + behaviorDuration;
//		targetFire.setStatus (true);
//		wallGunSpawner.setStatus (true);

        gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController> ();
    }
コード例 #9
0
 private void Start()
 {
     trapSpawner  = FindObjectOfType <TrapSpawner>();
     gameManager  = FindObjectOfType <GameManager>();
     audioManager = FindObjectOfType <AudioManager>();
 }
コード例 #10
0
 private void Awake()
 {
     mummySpawner = GetComponentInChildren <MummySpawner>();
     trapSpawner  = GetComponentInChildren <TrapSpawner>();
 }