示例#1
0
    private void Awake()
    {
        gameplayLogic = GameObject.Find("Gameplay Manager");

        if (gameplayLogic)
        {
            gameplayLogicScript = gameplayLogic.GetComponent <GameplayLogic>();
        }
    }
    private void Awake()
    {
        playerAvatar = GameObject.Find("Player's Avatar");
        gameplay     = GameObject.Find("Gameplay Manager");
        chAnim       = GameObject.Find("char_anim_0").GetComponent <CharacterAnimation>();
        jumpPartSyst = GameObject.Find("Jump Effects").GetComponent <ParticleSystem>();

        if (gameplay)
        {
            gameplayLogic = gameplay.GetComponent <GameplayLogic>();
        }
    }
示例#3
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.layer == 8) // p1
     {
         GameplayLogic.DamagePlayer(1, Damage);
     }
     else if (collision.gameObject.layer == 9) // p2
     {
         GameplayLogic.DamagePlayer(2, Damage);
     }
     Destroy(gameObject);
 }
示例#4
0
    // Use this for initialization
    void Start()
    {
        var direction = AsteroidsMathHelper.randomDirectionXZ();

        this.GetComponent <Rigidbody>().velocity = direction * Random.Range(minSpawnSpeed, maxSpawnSpeed);

        this.rotationAxis = Random.onUnitSphere;
        this.GetComponent <Rigidbody>().rotation = Random.rotation;

        GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController");

        if (gameControllerObject)
        {
            gameplay = gameControllerObject.GetComponent <GameplayLogic>();
        }
    }
示例#5
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.layer == 8) //p1
     {
         if (GameplayLogic.playerCollectedElements[0].Count < 4)
         {
             GameplayLogic.playerCollectedElements[0].Add(elementType);
             GameplayLogic.SpawnPiece(elementType);
             Destroy(gameObject);
         }
     }
     else if (other.gameObject.layer == 9) //p2
     {
         if (GameplayLogic.playerCollectedElements[1].Count < 4)
         {
             GameplayLogic.playerCollectedElements[1].Add(elementType);
             GameplayLogic.SpawnPiece(elementType);
             Destroy(gameObject);
         }
     }
 }
示例#6
0
 void SetComponents()
 {
     createBoard   = GetComponent <CreateBoard>();
     gameplayLogic = GetComponent <GameplayLogic>();
 }
 // Use this for initialization
 void Start()
 {
     gameLogic           = GetComponent <GameplayLogic>();
     currentWaitTime     = initialWaitTime;
     lastLetterInputTime = Time.time;
 }