Ejemplo n.º 1
0
        protected override void Awake()
        {
            base.Awake();

            spawnPoints   = SmashGame.GetSpawnPoints();
            repsawnPoints = SmashGame.GetRespawnPoints();

            if (backgroundMusic != null)
            {
                backgroundMusic.PlayRandom();
            }

            // Sort the Spawn Points by name instead of by random spatial orientation
            Array.Sort(spawnPoints, (s1, s2) => s1.name.CompareTo(s2.name));

            if (mainCamera != null)
            {
                return;
            }

            mainCamera = Camera.main ?? FindObjectOfType <Camera>();

            if (mainCamera == null)
            {
                Debug.LogError("Stage has no Camera!");
            }
        }
Ejemplo n.º 2
0
        private void Change(Collider target, bool targetValue)
        {
            if (target == null || !SmashGame.IsPlayer(target))
            {
                return;
            }

            var character = target.GetComponentInParent <Character>();

            character.IsGrounded = targetValue;
        }
Ejemplo n.º 3
0
        protected void ChangeIgnore(Collider target, bool state)
        {
            if (target == null || !SmashGame.IsPlayer(target))
            {
                return;
            }

            foreach (Collider col in _toIgnore)
            {
                Physics.IgnoreCollision(col, target, state);
            }
        }
Ejemplo n.º 4
0
        private void OnBlastZoneExit()
        {
            if (!enabled)
            {
                return;
            }
            Transform respawnPos = Stage.RespawnPosition;

            Character.position = respawnPos.position;
            Character.rotation = respawnPos.rotation;
            SmashGame.CreateRespawnPlatform(Character);
        }
Ejemplo n.º 5
0
        private void Check(Collider col)
        {
            if (!SmashGame.IsPlayer(col))
            {
                return;
            }

            var character = col.gameObject.GetComponentInParent <Character>();

            if (character == null)
            {
                return;
            }

            if (character.InputSource.Crouch)
            {
                ChangeIgnore(col, true);
            }
        }
Ejemplo n.º 6
0
        private void OnTriggerExit(Collider other)
        {
            // Filter only for player characters
            if (!SmashGame.IsPlayer(other))
            {
                return;
            }

            Character characterScript = other.GetComponentInParent <Character>() ??
                                        other.GetComponentInChildren <Character>();

            if (characterScript == null)
            {
                Debug.Log("Was expecting" + other.name + " to be a Player, but no Character script was found.");
                return;
            }

            if (col.ClosestPointOnBounds(characterScript.position) == characterScript.position)
            {
                return;
            }

            characterScript.BlastZoneExit();
        }