Beispiel #1
0
 // Use this for initialization
 void Awake()
 {
     crouch = GetComponent <Crouch>();
     jumpAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Jump, true);
     body   = GetComponent <ChipmunkBody>();
     resetStatus();
 }
Beispiel #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();
        }
    }
 // 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;
 }
Beispiel #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();
    }
Beispiel #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;
    }
Beispiel #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);
    }
Beispiel #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;
    }
Beispiel #8
0
 void Start()
 {
     lookUpwards     = GetComponent <LookUpwards>();
     walkAC_orig     = walkAC;
     walkLookingUpAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.WalkLookUpwards, true);
 }
Beispiel #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);
 }
Beispiel #10
0
 void Start()
 {
     // NOTE: it seems that Awake() from children are executed after parent's Awake()
     idleAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Idle, true);
 }
Beispiel #11
0
 void Awake()
 {
     sneakAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Sneak, true);
 }