Esempio n. 1
0
 // Use this for initialization
 void Awake()
 {
     crouch = GetComponent <Crouch>();
     jumpAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Jump, true);
     body   = GetComponent <ChipmunkBody>();
     resetStatus();
 }
Esempio n. 2
0
    public void setIdle(bool force)
    {
        // not idle if jumping and force = false
        if (!force && jump != null && jump.IsJumping())
        {
            return;
        }

        if (move != null)
        {
            move.stopWalking();
        }

        if (crouch != null)
        {
            crouch.noCrouch();
        }

        // due to problems on Unity's initialization order there is a use case where the object isn't instantiated
        if (idleAC == null)
        {
            idleAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Idle, true);
        }
        if (idleAC != null)
        {
            idleAC.setupAndPlay();
        }
    }
Esempio n. 3
0
 // Use this for initialization
 void Awake()
 {
     lookUpAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.LookUpwards, true);
     dirSign  = 0f;
     walk     = GetComponent <PlayerWalk>();
     // since we cannot create an instance from a MonoBehaviour then do next
     tempConfig = gameObject.AddComponent <PlayerFollowerXYConfig>();
     // disable the dummy component from being updated by Unity3D game loop
     tempConfig.enabled = false;
 }
Esempio n. 4
0
    void Awake()
    {
        jump   = GetComponent <Jump>();
        idle   = GetComponent <Idle>();
        crouch = GetComponent <Crouch>();
        shape  = GetComponent <ChipmunkShape>();
        walkAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Walk, true);

        lookingRight = true;
        reset();
    }
Esempio n. 5
0
    void Awake()
    {
        jump      = GetComponent <Jump>();
        idle      = GetComponent <Idle>();
        crouch    = GetComponent <Crouch>();
        body      = GetComponent <ChipmunkBody>();
        walkAC    = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Walk, true);
        agUpdater = GetComponent <AirGroundControlUpdater>();

        lookingRight = true;
    }
Esempio n. 6
0
    void Awake()
    {
        crouching = false;

        // take the collider and some useful values
        box             = GetComponent <ChipmunkBoxShape>();
        colliderCenterY = box.center.y;
        centerOffsetY   = ((1f - crouchColliderProportion) * 0.5f) * box.size.y;

        jump     = GetComponent <Jump>();
        sneak    = GetComponent <Sneak>();
        move     = GetComponent <WalkAbs>();
        crouchAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Crouch, true);
    }
Esempio n. 7
0
    // Use this for initialization
    void Awake()
    {
        hideAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Hide, true);
        hidden = false;

        // take the collider and some useful values
        ChipmunkBoxShape[] boxes = GetComponents <ChipmunkBoxShape>();
        for (int i = 0, c = boxes.Length; i < c; ++i)
        {
            box = boxes[i];
            // the koopa has two chipmunk boxes, take the correct one
            if ("KoopaTroopa".Equals(box.collisionType))
            {
                break;
            }
        }
        colliderCenterY = box.center.y;
        centerOffsetY   = ((1f - hideColliderProportion) * 0.5f) * box.size.y;
    }
Esempio n. 8
0
 void Start()
 {
     lookUpwards     = GetComponent <LookUpwards>();
     walkAC_orig     = walkAC;
     walkLookingUpAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.WalkLookUpwards, true);
 }
Esempio n. 9
0
 void Start()
 {
     // NOTE: children's Awake() doesn't exist on parent's Awake(), so you must get children components on Start()
     idleAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Idle, true);
 }
Esempio n. 10
0
 void Start()
 {
     // NOTE: it seems that Awake() from children are executed after parent's Awake()
     idleAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Idle, true);
 }
Esempio n. 11
0
 void Awake()
 {
     sneakAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Sneak, true);
 }