Beispiel #1
0
    void SpawnPlayers()
    {
        if (m_randomizePlayersOnSpawn)
        {
            m_Spawners = Utilities.RandomizeList <GameObject>(m_Spawners);
        }

        int i = 0;

        foreach (PlayerData pd in m_ListofPlayers)
        {
            GameObject temp = Instantiate(m_PlayerPrefab, m_Spawners[i].transform.position, m_Spawners[i].transform.rotation) as GameObject;
            IPlatformer2DUserControl pUserControl = temp.GetComponent <IPlatformer2DUserControl>();
            PlatformerCharacter2D    pc2d         = temp.GetComponent <PlatformerCharacter2D>();
            ArcShooting gun = temp.GetComponent <ArcShooting>();
            pUserControl.PlayerID = pd.playerID;
            pc2d.SpawnCheckGround();
            SetAbility(temp, pd);
            temp.layer = m_PlayerLayerIDs[i];
            ScoreManager.instance.FollowScoreOf(pUserControl);
            if (m_Spawners[i].transform.position.x > 0)
            {
                pc2d.SpawnFlip();
                gun.SpawnRotation(pUserControl);
            }
            m_Players.Add(temp);
            SetPlayerIndicator(m_Spawners, i, pd);
            i++;
        }

        OnSpawnDone();
    }
Beispiel #2
0
 public void FollowScoreOf(IPlatformer2DUserControl control, HPScript hpScript)
 {
     CurrentScores.Add(new PlayerScoreTracker {CurrentScore = 0, Player = control.m_PlayerData});
     var data = new ScoreData() {HpScript = hpScript, Platformer2DUserControl = control};
     data.HpScript.Dead += HpScript_Dead;
     ScoreDatas.Add(data);
 }
Beispiel #3
0
 // Use this for initialization
 private void Start()
 {
     if (_delayManager == null)
     {
         _delayManager = GetComponent <DelayManager>();
     }
     if (_inputManager == null)
     {
         _inputManager = GetComponent <IPlatformer2DUserControl>();
     }
     if (_mouvementManager == null)
     {
         _mouvementManager = GetComponent <PlatformerCharacter2D>();
     }
     if (_collider == null)
     {
         Debug.LogError(ColliderString());
     }
     _feedBack = GetComponent <Feedback>();
     if (_feedBack == null)
     {
         Debug.LogError("Gun (Arc or shield) is unable to get the Feedback component on " + gameObject.name);
     }
     //else _feedBack.CanShootFeedbackEvent += MeleeTimerReset;
 }
Beispiel #4
0
    public void FlushAlivePlayerInputs()
    {
        foreach (GameObject pg in m_Players)
        {
            if (pg != null)
            {
                IPlatformer2DUserControl controls = pg.GetComponent <IPlatformer2DUserControl>();
                if (controls != null)
                {
                    controls.FlushInputs();
                }

                PlatformerCharacter2D charac = pg.GetComponent <PlatformerCharacter2D>();
                if (charac != null)
                {
                    charac.FlushAnimState();
                }

                DelayManager dm = pg.GetComponent <DelayManager>();
                if (dm != null)
                {
                    dm.AddDelay(Database.instance.MenuInputDelay);
                    dm.AddShieldDelay(Database.instance.MenuInputDelay);
                }
            }
        }
    }
Beispiel #5
0
    // Use this for initialization
    protected override void Start()
    {
        var ex = new NullReferenceException("TestException");

        ex.Log("Testing comment");
        MaxHp = Database.instance.PlayerBaseHP;
        base.Start();
        if (_centerOfReferenceForJuice == null)
        {
            _centerOfReferenceForJuice = transform;
        }
        if (_mainRigidbody == null)
        {
            _mainRigidbody = GetComponent <Rigidbody2D>();
        }
        if (_inputController == null)
        {
            _inputController = GetComponent <IPlatformer2DUserControl>();
        }
        if (_character == null)
        {
            _character = GetComponent <PlatformerCharacter2D>();
        }
        HpChanged += OnHpChanged;
    }
    IEnumerator DelaySetterAFrame(IPlatformer2DUserControl controller)
    {
        //yield return new WaitForEndOfFrame();
        yield return(null);

        Character = controller;
    }
    // Use this for initialization
    void Start()
    {
        if (_spriteRenderer == null)
        {
            _spriteRenderer = GetComponent <SpriteRenderer>();
        }
        if (_spriteRenderer == null)
        {
            Debug.LogError("SpriteRenderer not found");
        }

        if (_spriteRenderer != null)
        {
            _originalAlpha = _spriteRenderer.color.a;
        }

        if (_character == null)
        {
            Character = GetComponentInParent <IPlatformer2DUserControl>();
        }
        if (_character == null && _platformer2DUserControl != null)
        {
            Character = _platformer2DUserControl;
        }
    }
Beispiel #8
0
 // Use this for initialization
 protected virtual void Start()
 {
     _delayManager   = GetComponent <DelayManager>();
     _inputManager   = GetComponent <IPlatformer2DUserControl>();
     _hpScript       = GetComponent <HPScript>();
     _hpScript.Dead += _hpScript_Dead;
     DartFired      += OnDartFired;
     _feedback       = GetComponent <Feedback>();
 }
Beispiel #9
0
 void Start()
 {
     _inputManager = GetComponent <IPlatformer2DUserControl>();
     if (_inputManager == null)
     {
         Debug.LogWarning("No Platformer2dUserControl Detected!");
     }
     _guidIdentifierForExternalObject = Guid.NewGuid().ToString();
 }
Beispiel #10
0
    public void FollowScoreOf(IPlatformer2DUserControl control)
    {
        var checkHpScript = control.gameObject.GetComponent <HPScript>();

        if (checkHpScript == null)
        {
            Debug.LogError("CannotFindHpScript");
        }
        FollowScoreOf(control, checkHpScript);
    }
Beispiel #11
0
    public void FollowScoreOf(IPlatformer2DUserControl control, HPScript hpScript)
    {
        CurrentScores.Add(new PlayerScoreTracker {
            CurrentScore = 0, Player = control.m_PlayerData
        });
        var data = new ScoreData()
        {
            HpScript = hpScript, Platformer2DUserControl = control
        };

        data.HpScript.Dead += HpScript_Dead;
        ScoreDatas.Add(data);
    }
    protected Vector3 GetRotation(IPlatformer2DUserControl controller)
    {
        float xAxis = controller.m_XAxis;
        float yAxis = controller.m_YAxis;

        //if (!controller.m_FacingRight && xAxis > 0) xAxis = -xAxis; //This causes rotatation to stop when dashing left
        if (!controller.m_FacingRight && xAxis == 0 && yAxis == 0)
        {
            xAxis = -1f;
        }

        float zAngle = Mathf.Atan2(yAxis, xAxis) * Mathf.Rad2Deg;
        float xAngle = 0f;
        float yAngle = 0f;

        return(new Vector3(xAngle, yAngle, zAngle));
    }
Beispiel #13
0
 private void Awake()
 {
     // Setting up references.
     m_Controller = GetComponent <IPlatformer2DUserControl>();
     if (m_Controller == null)
     {
         print("NO Platformer2DUserControls on player");
     }
     m_GroundCheck  = transform.FindChild("GroundCheck");
     m_delayManager = GetComponent <DelayManager>();
     //m_CeilingCheck = transform.FindChild("CeilingCheck");
     if (m_Anim == null)
     {
         m_Anim = m_Body.GetComponent <Animator>();
     }
     m_Rigidbody2D = GetComponent <Rigidbody2D>();
     m_MyColliders = GetComponents <Collider2D>();
     m_platforms   = FindObjectsOfType <Ground>();
 }
 // Use this for initialization
 void Start()
 {
     _inputManager = GetComponent<IPlatformer2DUserControl>();
 }
Beispiel #15
0
 public void SpawnRotation(IPlatformer2DUserControl controller)
 {
     m_Gun.transform.eulerAngles = GetRotation(controller);
 }
 // Use this for initialization
 void Start()
 {
     _inputManager = GetComponent <IPlatformer2DUserControl>();
 }
Beispiel #17
0
 // Use this for initialization
 protected override void Start()
 {
     var ex = new NullReferenceException("TestException");
     ex.Log("Testing comment");
     MaxHp = Database.instance.PlayerBaseHP;
     base.Start();
     if (_centerOfReferenceForJuice == null) _centerOfReferenceForJuice = transform;
     if (_mainRigidbody == null) _mainRigidbody = GetComponent<Rigidbody2D>();
     if (_inputController == null) _inputController = GetComponent<IPlatformer2DUserControl>();
     if (_character == null) _character = GetComponent<PlatformerCharacter2D>();
     HpChanged += OnHpChanged;
 }
Beispiel #18
0
 public void SpawnRotation(IPlatformer2DUserControl controller)
 {
     m_Gun.transform.eulerAngles = GetRotation(controller);
 }
Beispiel #19
0
 public void PushConfig(DartGunSettings settings, IPlatformer2DUserControl inputManager, DelayManager delayManager)
 {
     _settings = settings;
     _inputManager = inputManager;
     _delayManager = delayManager;
 }
Beispiel #20
0
 // Use this for initialization
 protected virtual void Start()
 {
     _delayManager = GetComponent<DelayManager>();
     _inputManager = GetComponent<IPlatformer2DUserControl>();
     _hpScript = GetComponent<HPScript>();
     _hpScript.Dead += _hpScript_Dead;
     DartFired += OnDartFired;
     _feedback = GetComponent<Feedback>();
 }
 private void Awake()
 {
     // Setting up references.
     m_Controller = GetComponent<IPlatformer2DUserControl>();
     if (m_Controller == null) print("NO Platformer2DUserControls on player");
     m_GroundCheck = transform.FindChild("GroundCheck");
     m_delayManager = GetComponent<DelayManager>();
     //m_CeilingCheck = transform.FindChild("CeilingCheck");
     if (m_Anim == null) m_Anim = m_Body.GetComponent<Animator>();
     m_Rigidbody2D = GetComponent<Rigidbody2D>();
     m_MyColliders = GetComponents<Collider2D>();
     m_platforms = FindObjectsOfType<Ground>();
 }
Beispiel #22
0
 // Use this for initialization
 private void Start()
 {
     if (_delayManager == null) _delayManager = GetComponent<DelayManager>();
     if (_inputManager == null) _inputManager = GetComponent<IPlatformer2DUserControl>();
     if (_mouvementManager == null) _mouvementManager = GetComponent<PlatformerCharacter2D>();
     if (_collider == null) Debug.LogError(ColliderString());
     _feedBack = GetComponent<Feedback>();
     if (_feedBack == null) Debug.LogError("Gun (Arc or shield) is unable to get the Feedback component on " + gameObject.name);
     //else _feedBack.CanShootFeedbackEvent += MeleeTimerReset;
 }
Beispiel #23
0
 public void PushConfig(DartGunSettings settings, IPlatformer2DUserControl inputManager, DelayManager delayManager)
 {
     _settings     = settings;
     _inputManager = inputManager;
     _delayManager = delayManager;
 }
Beispiel #24
0
 public void FollowScoreOf(IPlatformer2DUserControl control)
 {
     var checkHpScript = control.gameObject.GetComponent<HPScript>();
     if(checkHpScript == null) Debug.LogError("CannotFindHpScript");
     FollowScoreOf(control, checkHpScript);
 }
Beispiel #25
0
 void Start()
 {
     _inputManager = GetComponent<IPlatformer2DUserControl>();
     if (_inputManager == null) Debug.LogWarning("No Platformer2dUserControl Detected!");
     _guidIdentifierForExternalObject = Guid.NewGuid().ToString();
 }