private void Awake()
    {
        heroesPanel = heroesPanelObj.GetComponent <HeroesPanel>();
        switch (defaultHero)
        {
        case HeroType.Ninja: activeHero = ninja;
            break;

        case HeroType.Tank: activeHero = tank;
            break;

        case HeroType.Technomancer: activeHero = technomancer;
            break;

        case HeroType.Warrior: activeHero = warrior;
            break;
        }
        heroesPanel.ChangeActiveHero(defaultHero);

        activeHero.SetActive(true);
        cameraFollowing        = camera.GetComponent <CameraFollowing>();
        cameraFollowing.Target = activeHero.transform;

        ninjaCooldownImage        = ninjaCooldown.GetComponent <Image>();
        tankCooldownImage         = tankCooldown.GetComponent <Image>();
        technomancerCooldownImage = technomancerCooldown.GetComponent <Image>();
        warriorCooldownImage      = warriorCooldown.GetComponent <Image>();
    }
Example #2
0
    //public GameObject parentObject;
    //public Vector3 offsetFromPlatform;
    //GameObject playerFlowerCollider;

    void Start()
    {
        rigid                 = transform.rigidbody2D;
        animT                 = transform.FindChild("Animator");
        ator                  = animT.GetComponent <Animator>();
        stamina               = GetComponent <Stamina>();
        camFollow             = GetComponent <CameraFollowing>();
        doubleJumpParticleGen = GameObject.Find("Double Jump Particle Generator").GetComponent <ParticleGenerator>();
        dustParticleGen       = GameObject.Find("Dust Particle Generator").GetComponent <ParticleGenerator>();
        dashParticleGen       = GameObject.Find("Dash Particle Generator").GetComponent <ParticleGenerator>();
        soundHandler          = GameObject.Find("Sound Handler").GetComponent <SoundHandler>();

        animT.localPosition = new Vector3(-0.18f, 0.04f, 1.0f);
        padInput            = Vector2.zero;
        onGround            = false;
        idleTimer           = 0.0f;


        //basic
        moveAccel            = 35.0f; //movement accel. and decel.
        moveDecel            = 40.0f;
        moveSpeed            = 4.0f;  //max move speed
        jumpStrength         = 5.8f;
        airFriction          = 9.0f;  //velocity.x slow down in air
        deadZone             = 0.3f;
        allowInput           = true;
        allowCameraFollowing = true;


        //while gliding
        gliding = false;                //gliding state
        glideDefaceDirection   = Vector3.zero;
        glideDeFaceThreshold   = 3.99f; //direction can't be changed when (-glideDeFaceThreshold < velocity.x < glideDeFaceThreshold)
        glideAllowDeFace       = true;  //allow changing direction
        glideSteepness         = 0.25f; //how much the player descends while gliding
        glideControl           = 8.0f;  //how much the gliding speed can be affected by input
        glideZeroAcc           = 6.0f;  //acceleration from zero velocity
        glideGravityResistance = 15.0f; //how much gravity resistance when starting to glide while falling
        glideHitWallTimer      = 0.0f;
        glideHitWallPenalty    = 0.6f;


        //dashing
        dashing       = false;
        dashTimer     = 0.0f;
        dashLength    = 0.3f;
        dashSpeed     = 8.0f;
        faceDirection = new Vector3(1.0f, 0.0f, 0.0f);


        //boost
        allowBoost    = true;      //clears after boosting, sets when touching ground or ?
        boostStrength = 5.7f;
    }
Example #3
0
    public void InitializeCamera()
    {
        //Debug.Log("CameraInitialization From :" + this);

        CameraFollowing cam = (CameraFollowing)GameObject.FindObjectOfType(typeof(CameraFollowing));

        cam.m_Targets = new Transform[gameManager.playersManager.charactersPlayedNow.Length];

        for (int i = 0; i < cam.m_Targets.Length; i++)
        {
            cam.m_Targets [i] = gameManager.playersManager.charactersPlayedNow [i].transform;
        }
        cam.enabled = true;

        cameraIsLoaded = true;
    }
Example #4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        GameObject otherObject = other.gameObject;

        playerController = player.GetComponent <PlayerController>();
        if (otherObject.CompareTag("Player"))
        {
            GameObject bossGate = Instantiate(bossgate) as GameObject;
            mainCamera      = Camera.main;
            camerafollowing = mainCamera.GetComponent <CameraFollowing>();
            //Debug.Log("boss!");
            Destroy(this.GetComponent <BoxCollider2D>());
            BossHealthContainer.enabled = true;
            BossFullHealth.enabled      = true;
            playerController.inBossArea = true;
        }
    }
Example #5
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
        }

        m_AssetManager.Init();
        m_ResourceManager.Init();
        m_ObjectPool.Init();
        m_MapInfo = Instantiate(m_MapInfo);
        m_MapInfo.Init();
        UIInGameMain.Instance.Init();
        m_ItemManager.Init();
        m_MissionManager.Init();
        m_MobManager.Init();
        m_CameraFollowing = Camera.main.GetComponent <CameraFollowing>();
        m_PlayerManager   = this.gameObject.AddComponent <InGamePlayerManager>();
        m_RewardManager   = new GameObject("RewardManager").AddComponent <InGameRewardManager>();
    }
Example #6
0
 private void Awake()
 {
     instance = this;
 }
Example #7
0
 private void Awake()
 {
     transformCache = transform;
     cameraPlayerFollowController = GetComponent <CameraFollowing>();
 }