Beispiel #1
0
    private void Awake()
    {
        transformer  = gameObject.GetComponent <Transform>();
        rigidBody    = gameObject.GetComponent <Rigidbody2D>();
        animator     = gameObject.GetComponent <Animator>();
        spriteRender = gameObject.GetComponent <SpriteRenderer>();
        collider     = gameObject.GetComponent <Collider2D>();
        movement     = gameObject.GetComponent <IPlayerMovement>();

        //--Init MovementController---
        movementController = gameObject.GetComponent <MovementController>();
        movementController.Init(movement, physicStats);

        //--Init MetterCounter---
        if (!meterCounter)
        {
            meterCounter = gameObject.AddComponent <MeterCounter>();
        }
        meterCounter.Init(gameStats, transformer);
        //--Init BonusSystem---
        bonusSystem = gameObject.GetComponent <BonusSystem>();
        //--Init Speed booster
        speedBooster = gameObject.GetComponent <PlayerSpeedIncreaser>();
        speedBooster.Init();
        //--Init Effects---
        tailEffects    = transform.FindChild("TailEffects").gameObject;
        deathEffects   = transform.FindChild("DeathEffects").gameObject;
        barrierEffects = transform.FindChild("BarrierEffects").gameObject;

        //--Init Events---
        gameStats.onIsAliveChange += LeadersSystem.ReportLeader;
        gameStats.onIsAliveChange += UserStats.Instance.SaveCurrency;
    }
Beispiel #2
0
    void Start()
    {
        GameObject metercounterScriptRef = GameObject.Find("MeterTxt");

        altitudeCounter = metercounterScriptRef.GetComponent <MeterCounter>();

        GameObject cameracontrollerScriptRef = GameObject.Find("Main Camera");

        camBoxCenter = cameracontrollerScriptRef.GetComponent <CameraController>();
        limiter      = 0;
    }