示例#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
    }
示例#2
0
 void Start()
 {
     lookUpwards     = GetComponent <LookUpwards>();
     walkAC_orig     = walkAC;
     walkLookingUpAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.WalkLookUpwards, true);
 }