Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     PlayerState = State.OnGround;
     pms         = GetComponent <PlayerMovementSmooth>();
     climb       = GetComponent <Climb>();
     lame        = GetComponent <LadderMovement>();
     gc          = GetComponentInChildren <GroundCheck>();
 }
Exemplo n.º 2
0
    /// <summary>
    /// On awake, initialize varaibles.
    /// </summary>
    protected void Awake()
    {
        Debug.Assert(oddsOfClimbingLadderUp >= 0);
        Debug.Assert(oddsOfClimbingLadderDown >= 0);

        walkMovement   = GetComponent <WalkMovement>();
        ladderMovement = GetComponent <LadderMovement>();

        Debug.Assert(ladderMovement != null);
    }
Exemplo n.º 3
0
    /// <summary>
    /// On awake, populate vars.
    /// </summary>
    protected void Awake()
    {
        myBody = GetComponent <Rigidbody2D>();

        LadderMovement ladderMovement = GetComponent <LadderMovement>();

        ladderMovement.onGettingOffLadder += ClimbLadder_onGettingOffLadder;
        ladderMovement.onGettingOnLadder  += LadderMovement_onGettingOnLadder;

        Debug.Assert(myBody != null);
    }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     isDeath         = false;
     counter         = GetComponent <Score> ();
     shadowScript    = GetComponent <shadowWalk> ();
     groundScript    = GetComponent <GroundMovement> ();
     ladderScript    = GetComponent <LadderMovement> ();
     pushPullScript  = GetComponent <PushPullMovement> ();
     playerBody      = GetComponent <Rigidbody2D> ();
     playerAnimation = GetComponent <Animator>();
 }
Exemplo n.º 5
0
    /// <summary>
    /// On awake, initial variables.
    /// </summary>
    protected void Awake()
    {
        ladderMovement = GetComponentInParent <LadderMovement>();
        myCollider     = GetComponent <Collider2D>();

        floorFilter = new ContactFilter2D()
        {
            layerMask    = LayerMask.GetMask(new[] { "Floor" }),
            useLayerMask = true
        };

        Debug.Assert(ladderMovement != null);
        Debug.Assert(myCollider != null);
    }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        PlayerState = State.OnGround;

        jump  = GetComponent <Jump>();
        pms   = GetComponent <PlayerMovementSmooth>();
        climb = GetComponent <Climb>();
        lame  = GetComponent <LadderMovement>();

        whip = GetComponentInChildren <Whip>();
        gc   = GetComponentInChildren <GroundCheck>();

        playerCollider = GetComponent <BoxCollider2D>();
    }
Exemplo n.º 7
0
    /// <summary>
    /// On awake, populate variables and register for ladder events.
    /// Disable this component until fade completes (preventing movement).
    /// </summary>
    protected void Awake()
    {
        Debug.Assert(oddsOfGoingUpHill >= 0);
        Debug.Assert(timeBeforeFirstWander >= 0);

        walkMovement   = GetComponent <WalkMovement>();
        ladderMovement = GetComponent <LadderMovement>();
        feet           = GetComponentInChildren <Feet>();

        ladderMovement.onGettingOffLadder += LadderMovement_onGettingOffLadder;

        AppearInSecondsAndFadeInSprite.DisableMeTillComplete(this);

        Debug.Assert(walkMovement != null);
        Debug.Assert(feet != null);
    }
Exemplo n.º 8
0
    /// <summary>
    /// On awake, populate variables.
    /// </summary>
    protected void Awake()
    {
        instance = this;

        myBody         = GetComponent <Rigidbody2D>();
        feet           = GetComponent <Feet>();
        walkMovement   = GetComponent <WalkMovement>();
        jumpMovement   = GetComponent <JumpMovement>();
        ladderMovement = GetComponent <LadderMovement>();

        Debug.Assert(myBody != null);
        Debug.Assert(feet != null);
        Debug.Assert(walkMovement != null);
        Debug.Assert(jumpMovement != null);
        Debug.Assert(ladderMovement != null);
    }
Exemplo n.º 9
0
 void Start()
 {
     ladder_script = player.GetComponent <LadderMovement>();
     anim          = GameObject.Find("gIRL RIG").GetComponent <Animator>();
 }
    public void GenerateLevelData(bool withBackup = false)
    {
        Debug.Log(withBackup);
        if (withBackup)
        {
            level = backupLevel;
        }
        else
        {
            // Push all data to level
            List <LadderInfo> ladderInfos = new List <LadderInfo>();
            level = new Level(levelIndex, tutorialContent, ladderInfos);
            LevelUtil.setCurrentLevel(level);

            GameObject[] ladders = GameObjectUtils.FindGameObjectsWithTag(Constants.ObjectTags.ladder.ToString());
            GameObjectUtils.SortGameObjectByPositionY(ladders);
            for (int i = 0; i < ladders.Length; i++)
            {
                GameObject ladder          = ladders[i];
                LadderInfo ladderInfo      = new LadderInfo();
                Ladder     ladderComponent = ladder.GetComponent <Ladder>();

                ladderInfo.initAngle = -1 * ladderComponent.initAngle;
                ladderInfo.type      = Constants.LadderType.normalLadder;
                ladderInfo.timeout   = ladderComponent.timeout;

                LadderRotate ladderRotate = ladder.GetComponent <LadderRotate>();
                if (ladderRotate.speed > 0)
                {
                    ladderInfo.rotate = new LadderRotateData(ladderRotate.isClockwise, ladderRotate.speed);
                }
                else
                {
                    ladderInfo.rotate = null;
                }

                LadderMovement ladderMovement = ladder.GetComponent <LadderMovement>();
                if (ladderMovement.speed > 0)
                {
                    ladderInfo.initPosition.Fill(ladder.GetComponent <Explode>().initPosition);
                    MyVector3[] points = new MyVector3[ladderMovement.points.Count];
                    for (int j = 0; j < ladderMovement.points.Count; j++)
                    {
                        points[j] = new MyVector3();
                        points[j].Fill(ladderMovement.points[j]);
                    }
                    ladderInfo.movement = new LadderMovementData(ladderMovement.type, points, ladderMovement.distances, ladderMovement.speed, ladderMovement.radius, ladderMovement.isClockwise, ladderMovement.initAngle);
                }
                else
                {
                    ladderInfo.initPosition.Fill(ladder.transform.position);
                    ladderInfo.movement = null;
                }

                ladderInfos.Add(ladderInfo);
            }

            level.ladders = ladderInfos;
            backupLevel   = level;
        }
    }