Example #1
0
    private void Start()
    {
        _gameOver = false;

        _players = new List <GameObject>();

        Debug.Log(CharactersList.PlayerCount);

        for (int i = 0; i < CharactersList.PlayerCount; i++)
        {
            PlayerInfo info = CharactersList.GetInfo(i);
            GameObject aux  = GameObject.Instantiate(info.Prefab);

            aux.GetComponent <PlayerInputManeger>().ChangePlayer(info.PlayerId);
            aux.transform.position = _spawns[i].position;

            _targetGroup.AddMember(aux.transform, 1, 2.5f);
            _players.Add(aux);
        }

        foreach (Transform spawn in _spawns)
        {
            _targetGroup.RemoveMember(spawn);
        }

        _winner = null;
    }
Example #2
0
 public void Remove(Transform transformToRemove)
 {
     if (tg.FindMember(transformToRemove) >= 0)
     {
         playerCount--;
     }
     tg.RemoveMember(transformToRemove);
 }
Example #3
0
 private void OnDisable()
 {
     if (_group)
     {
         _group.RemoveMember(transform);
     }
 }
 public void ClearTargetObjects()
 {
     for (int i = 0; i < _targetObjects.Count; i++)
     {
         _targetGroup.RemoveMember(_targetObjects[i].transform);
     }
 }
 public void DisableCameraPortal()
 {
     if (!m_UseCenterWithPortal)
     {
         m_TargetGroup.RemoveMember(m_Portal.transform);
     }
 }
Example #6
0
 public void RemoveElementFromCrowd(CrowdElement ce)
 {
     crowd.Remove(ce);
     followingCrowd.Remove(ce);
     ce.currentlyInCrowd = false;
     ctg.RemoveMember(ce.transform);
 }
Example #7
0
 //This will clear the list and re-add everything if the amount of players changes suddenly during a round.
 //Im getting a gameobject instead of a transform for no real reason, i guess it just might give slightly more options on how to affect the object.
 public void RemoveTargetGroupMember(GameObject removeThis)
 {
     cinemachineTargetGroup.RemoveMember(removeThis.transform);
     for (int i = 0; i < FindObjectsOfType <Erin_UI_PlayerHealth>().Length; i++)
     {
         cinemachineTargetGroup.AddMember(GameObject.FindObjectsOfType <Erin_UI_PlayerHealth>()[i].transform, 1f, 1f);
     }
 }
Example #8
0
        public void RemoveFromCloseUpTargetGroup(CharacterControl unit)
        {
            Transform spine = unit.GetSpine();

            if (closeUpTargetGroup.FindMember(spine) != -1)
            {
                closeUpTargetGroup.RemoveMember(spine);
            }
        }
Example #9
0
        private void Sword_OnCollect(Player obj)
        {
            targetGroup.RemoveMember(sword.transform);

            swordTimestamp   = Time.time;
            sword.OnCollect -= Sword_OnCollect;
            obj.ActivateSword(true);
            _playerWithTheSword = obj;
        }
 private void Clear()
 {
     for (int i = targets.Count - 1; i >= 0; i--)
     {
         targetGroup.RemoveMember(targets[i]);
         if (i > 1)
         {
             targets.RemoveAt(i);
         }
     }
 }
Example #11
0
        public void FocusTarget(Transform focus)
        {
            if (m_FocusTarget != null)
            {
                focusTargetGroup.RemoveMember(m_FocusTarget);
            }

            m_FocusTarget = focus;
            focusTargetGroup.AddMember(m_FocusTarget, 0.2f, 1.0f);
            SetType(GameCameraType.LockOn);
        }
Example #12
0
    void RemoveBall()
    {
        GameObject ball = balls[removeIndex];

        if (ball != null)
        {
            targetGroup.RemoveMember(ball.transform);
            Destroy(ball);
            removeIndex = (removeIndex + 1) % balls.Length;
        }
    }
    // Start is called before the first frame update
    void OnEnable()
    {
        _cmTargetGroup = GetComponent <CinemachineTargetGroup>();
        while (_cmTargetGroup.m_Targets.Length > 0)
        {
            _cmTargetGroup.RemoveMember(_cmTargetGroup.m_Targets[0].target);
        }

        Cell[] cells = FindObjectsOfType <Cell>();
        foreach (var c in cells)
        {
            _cmTargetGroup.AddMember(c.transform, 1, Radius);
        }
    }
Example #14
0
        private void Update()
        {
            if (Vector2.Distance(_player.position, transform.position) <= _minActivationDistance && !_targetAdded)
            {
                _targetAdded = true;
                _targetCamera.AddMember(transform, _targetPriority, _targetRadius);
            }

            else if (Vector2.Distance(_player.position, transform.position) > _minActivationDistance && _targetAdded)
            {
                _targetAdded = false;
                _targetCamera.RemoveMember(transform);
            }
        }
Example #15
0
    void LateUpdate()
    {
        Transform currTarget = iKThrowController.GetTarget();

        if (lastTarget != currTarget)
        {
            if (aimingCameraTargetGroup.m_Targets.Length > 1)
            {
                aimingCameraTargetGroup.RemoveMember(lastTarget);
            }
            aimingCameraTargetGroup.AddMember(currTarget, 1.5f, 1.0f);
            lastTarget = currTarget;
        }
        UpdateTargetMarkerPosition();
    }
Example #16
0
 public void Explode()
 {
     exploded.transform.position = solid.transform.position;
     exploded.transform.rotation = solid.transform.rotation;
     solid.SetActive(false);
     solidRB.detectCollisions = false;
     exploded.SetActive(true);
     cmtg.RemoveMember(transform);
     for (int i = 0; i < count; i++)
     {
         explodedMat[i].SetFloat("damageBlend", damage);
         explodedRB[i].AddExplosionForce(explosionForce, transform.position, explosionRadius, upwardsModifier);
         StartCoroutine(FreezeCollisions(i, 3f));
     }
 }
Example #17
0
        private IEnumerator IncreaseWeight(GameObject objToIncrease)
        {
            var currentWeight     = settings.startWeight;
            var currentWeightLerp = 0f;
            var currentRadius     = settings.startRadius;
            var currentRadiusLerp = 0f;

            _target.AddMember(objToIncrease.transform, currentWeight, currentRadius);
            var member = _target.FindMember(objToIncrease.transform);

            var endFrame = new WaitForEndOfFrame();

            yield return(endFrame);

            while (currentRadiusLerp < 1 && currentWeightLerp < 1)
            {
                //currentRadius += Time.deltaTime * (endRadius - startRadius) * (1f/lerpDuration);
                currentRadiusLerp += Time.deltaTime * (1f / settings.lerpDuration);
                //currentWeight += Time.deltaTime * (endWeight - startWeight) * (1f/lerpDuration);
                currentWeightLerp += Time.deltaTime * (1f / settings.lerpDuration);


                _target.m_Targets[member].radius = Mathf.Lerp(settings.startRadius, settings.endRadius, currentRadiusLerp);
                _target.m_Targets[member].weight = Mathf.Lerp(settings.startWeight, settings.endWeight, currentWeightLerp);

                yield return(endFrame);
            }

            currentRadiusLerp = 1;
            currentWeightLerp = 1;

            yield return(new WaitForSeconds(1f));

            while (currentWeightLerp > 0 && currentRadiusLerp > 0)
            {
                currentRadiusLerp -= Time.deltaTime * (1f / settings.lerpDuration);
                currentWeightLerp -= Time.deltaTime * (1f / settings.lerpDuration);


                _target.m_Targets[member].radius = Mathf.Lerp(settings.startRadius, settings.endRadius, currentRadiusLerp);
                _target.m_Targets[member].weight = Mathf.Lerp(settings.startWeight, settings.endWeight, currentWeightLerp);

                yield return(endFrame);
            }

            _target.RemoveMember(objToIncrease.transform);
            _routines.Remove(objToIncrease);
        }
    public void UpdateTargetGroup(Player[] players)
    {
        foreach (var player in players)
        {
            cinemachineGroup.RemoveMember(player.transform);

            if (player.Prey)
            {
                cinemachineGroup.AddMember(player.transform, preyWeight, preyRadius);
            }
            else
            {
                cinemachineGroup.AddMember(player.transform, hunterWeight, hunterRadius);
            }
        }
    }
Example #19
0
        private void LateUpdate()
        {
            _playerPosition = _player.position;

            // Force Snap X Position
            _targetPosition.x = _playerPosition.x;

            // Handle Y Position
            if (Mathf.Abs(_targetPosition.y - _playerPosition.y) > _minYDistance)
            {
                if (!_targetingStarted)
                {
                    _mainTargetGroup.AddMember(_player, _playerWeight, 0);
                }

                _targetingStarted = true;
            }
            else if (Mathf.Abs(_targetPosition.y - _playerPosition.y) < _targetStopMinYDistance)
            {
                if (_targetingStarted)
                {
                    _mainTargetGroup.RemoveMember(_player);
                }

                _targetingStarted = false;
            }

            if (_targetYModifier)
            {
                _targetPosition.y = Mathf.Lerp(_targetPosition.y, _targetYModifier.position.y,
                                               _targetYModifierLerp * Time.deltaTime);
            }
            else if (_targetingStarted)
            {
                _targetPosition.y = Mathf.Lerp(_targetPosition.y, _playerPosition.y, _lerpSpeed * Time.deltaTime);
            }


            if (!_targetYModifier)
            {
                transform.position = _targetPosition + _playerFollowOffset;
            }
            else
            {
                transform.position = _targetPosition;
            }
        }
Example #20
0
    private void FixedUpdate()
    {
        if (GameSystem.instance.talk_trigger)
        {
            npc = GameSystem.instance.talk_npc_ob;
            AddTarget();
        }
        else
        {
            if (npc != null)
            {
                targetGroup.RemoveMember(npc.transform);
                npc = null;
            }

            vcam.gameObject.SetActive(false);
        }
    }
Example #21
0
        protected override void DoAction(CATContext context)
        {
            GameObject gobj = cinemachineTargetGroup.First(context);

            if (gobj == null)
            {
                return;
            }
            CinemachineTargetGroup group = gobj.GetComponentInChildren <CinemachineTargetGroup>();

            if (group == null)
            {
                return;
            }
            var all = cinemachineTargetGroup.GetTargets(context);

            if (all == null || all.Count < 1)
            {
                return;
            }

            float cachedWeight = weight.GetValue(context);
            float cachedRadius = radius.GetValue(context);

            switch (operation)
            {
            case EditOperation.Add:
                for (var i = 0; i < all.Count; ++i)
                {
                    group.AddMember(all[i].transform, cachedWeight, cachedRadius);
                }
                break;

            case EditOperation.Remove:
                for (var i = 0; i < all.Count; ++i)
                {
                    group.RemoveMember(all[i].transform);
                }
                break;

            default:
                throw new System.NotImplementedException("Unhandled EditOperation in " + name + ": " + operation);
            }
        }
Example #22
0
    private void Update()
    {
        if (transform.position.y <= flyLevel)
        {
            flying = true;
            Animator.SetBool("flying", flying);
        }

        if (flying == true)
        {
            GetComponent <Rigidbody2D>().gravityScale = -1;
        }

        if (transform.position.y > 10)
        {
            targetGroup.RemoveMember(transform);
            Debug.Log("enemy went high");
        }
    }
Example #23
0
    public void Die()
    {
        if (dead == false)
        {
            dead = true;
            //dying stuff here
            cmTargets.RemoveMember(gameObject.transform);
            PlayerSelect.ingameplayers[pmovement.PlayerId - 1] = null;
            Instantiate(ragdoll, transform.position, transform.rotation);
            Destroy(gameObject);

            if (PlayerSelect.VictoryCheck() == true)
            {
                Time.timeScale = 0.1f;
                new WaitForSecondsRealtime(2);
                Time.timeScale = 1;
                //Debug.Log(PlayerSelect.GetWinner());
            }
        }
    }
Example #24
0
    IEnumerator EndGameSequence()
    {
        float timeScale   = 1f;
        float controlRate = 0.01f / 1; // waitforseconds / seconds

        targetGroup.RemoveMember(targetGroup.m_Targets[0].target);
        GAMEanimator.Play("GAME");
        audioManager.Play("GAME");
        while (timeScale > 0f)
        {
            Time.timeScale = timeScale;
            yield return(new WaitForSecondsRealtime(0.01f));

            timeScale -= controlRate;
        }

        timeScale      = 0f;
        Time.timeScale = timeScale;
        ChangeScene("EndGame");
    }
Example #25
0
 void Lock(GameObject target)
 {
     if (lockOn)
     {
         lockOn                    = false;
         lockOnCam.enabled         = false;
         freeLookCam.m_YAxis.Value = .5f;
         freeLookCam.enabled       = true;
         lockOnGroup.RemoveMember(lockOnTarget.transform);
         lockOnTarget = null;
     }
     else
     {
         lockOn       = true;
         lockOnTarget = target;
         lockOnGroup.AddMember(target.transform, 2, 2);
         freeLookCam.enabled = false;
         lockOnCam.enabled   = true;
     }
     MovementManager.instance.SetLock(lockOn);
 }
Example #26
0
    IEnumerator CheckInvadersRoutine()
    {
        // Red
        for (int i = 0; i < battleInfo.redInvaders.Count; i++)
        {
            if (redInvadersTg.FindMember(battleInfo.redInvaders[i].transform) == -1)
            {
                redInvadersTg.AddMember(battleInfo.redInvaders[i].transform, 0, 0);
            }
        }

        for (int i = 0; i < redInvadersTg.m_Targets.Length; i++)
        {
            if (!battleInfo.redInvaders.Contains(redInvadersTg.m_Targets[i].target.GetComponent <LittleDude>()))
            {
                redInvadersTg.RemoveMember(redInvadersTg.m_Targets[i].target);
            }
        }

        // Blue
        for (int i = 0; i < battleInfo.blueInvaders.Count; i++)
        {
            if (blueInvadersTg.FindMember(battleInfo.blueInvaders[i].transform) == -1)
            {
                blueInvadersTg.AddMember(battleInfo.blueInvaders[i].transform, 0, 0);
            }
        }

        for (int i = 0; i < blueInvadersTg.m_Targets.Length; i++)
        {
            if (!battleInfo.blueInvaders.Contains(blueInvadersTg.m_Targets[i].target.GetComponent <LittleDude>()))
            {
                blueInvadersTg.RemoveMember(blueInvadersTg.m_Targets[i].target);
            }
        }

        yield return(new WaitForSeconds(1));

        StartCoroutine(CheckInvadersRoutine());
    }
Example #27
0
    void PlayerDied(Character player)
    {
        bool lastPlayerDied = characters.TrueForAll((c) => c.IsDead);

        if (!lastPlayerDied)
        {
            foreach (CinemachineTargetGroup.Target target in targetGroup.m_Targets)
            {
                targetGroup.RemoveMember(target.target);
            }
            foreach (Character c in characters)
            {
                if (!c.IsDead)
                {
                    targetGroup.AddMember(c.transform, weight, radius);
                }
            }
        }
        else
        {
            IngamePanelManager.Instance?.Defeat();
        }
    }
Example #28
0
        public void RemoveTarget(Actor actor)
        {
            Debug.Log($"Removing viewer target {actor.Id}");

            _targetGroup.RemoveMember(actor.transform);
        }
 public void RemoveBouncerToTarget(Transform bouncer)
 {
     cameraTargetGroup.RemoveMember(bouncer);
     // print("bouncer removed from camera");
 }
Example #30
0
 private void RemoveFromCammeraGroup()
 {
     _cammeraTargetGroup.RemoveMember(_curentSpawnedPowerUp.transform);
     _curentSpawnedPowerUp = null;
 }