Exemple #1
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }

        PauseGameManager.Instance.register(this, gameObject);

        jump         = GetComponent <Jump>();
        walk         = GetComponent <PlayerWalk>();
        firePivot    = transform.FindChild("FirePivot");
        teleportable = GetComponent <Teleportable>();
        dieAnim      = GetComponent <PlayerDieAnim>();
        crouch       = GetComponent <Crouch>();
        idle         = GetComponent <Idle>();
        lookUpwards  = GetComponent <LookUpwards>();
        body         = GetComponent <ChipmunkBody>();

        walkVelBackup  = walkVelocity;
        rightFireDir.x = 1f;
        rightFireDir.y = -0.5f;
        leftFireDir.x  = -1f;
        leftFireDir.y  = -0.5f;
        fireDir        = rightFireDir;

        collisionGroupSkip = GetComponent <ChipmunkShape>().collisionGroup;
        collisionLayers    = unchecked ((uint)~(1 << gameObject.layer));     // all layers except Player's layer
    }
Exemple #2
0
    private void initialize()
    {
        jump           = GetComponent <Jump>();
        walk           = GetComponent <PlayerWalk>();
        firePivot      = transform.FindChild("FirePivot");
        teleportable   = GetComponent <Teleportable>();
        dieAnim        = GetComponent <PlayerDieAnim>();
        crouch         = GetComponent <Crouch>();
        idle           = GetComponent <Idle>();
        lookDirections = GetComponent <LookDirections>();
        body           = GetComponent <ChipmunkBody>();

        rightFireDir.x = 1f;
        rightFireDir.y = -0.5f;
        leftFireDir.x  = -1f;
        leftFireDir.y  = -0.5f;
        fireDir        = rightFireDir;

        collisionGroupSkip = GetComponent <ChipmunkShape>().collisionGroup;
        // not sure if ok: all layers except Player's layer
        collisionLayersSkip = unchecked ((uint)(1 << KLayers.PLAYER));
        //collisionLayers = 0;
    }