Beispiel #1
0
 private void DoRope()
 {
     if (!anchor)
     {
         for (int i = 0; i < transform.childCount; i++)
         {
             rope = transform.GetChild(i).GetComponent <RopeSystem>();
             if (rope)
             {
                 anchor = transform.GetChild(i).gameObject;
                 break;
             }
         }
     }
     if (!rope.placed)
     {
         rope.gameObject.SetActive(true);
         rope.transform.SetParent(null, true);
         rope.plantAnchor();
     }
     else if (rope.attached)
     {
         rope.release();
     }
     else
     {
         rope.reset();
     }
 }
Beispiel #2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Rope" && !sticked)
        {
            if (connectedRopeNode)
            {
                lastRopeSystem = connectedRopeNode.GetComponentInParent <RopeSystem>();
            }

            connectedRopeNode = col.GetComponent <RopeNode>();

            if (!connectedRopeNode.GetComponentInParent <RopeSystem>().enable)
            {
                return;
            }

            connectedRopeNode.GetComponent <Rigidbody2D>().mass += rigidBody.mass;
            forceToRope(rigidBody.velocity.x);

            boyTransform.parent   = connectedRopeNode.transform;
            lerpPosition          = 0;
            rigidBody.isKinematic = true;
            sticked = true;
            animator.SetBool("ClimbRope", true);

            if (humanController.pushing)
            {
                humanController.unPushObject();
            }
        }
    }
    void Awake()
    {
        m_rope = GetComponent <RopeSystem>();
        m_line = GetComponent <LineRenderer>();

        m_line.useWorldSpace = true;
    }
 // Start is called before the first frame update
 void Start()
 {
     torchCount          = torchCount2;
     rb                  = GetComponent <Rigidbody2D>();
     currentGravityScale = rb.gravityScale;
     Debug.Log(currentGravityScale);
     anim       = GetComponent <Animator>();
     ropeSystem = this.GetComponent <RopeSystem>();
 }
Beispiel #5
0
 void Start()
 {
     mainCam = Camera.main.transform;
     rope    = RopeSystem.instnace;
     //speedSpinCollider = GameObject.Find("speedSpinCollider").transform;
     //speedSpinMinScale = speedSpinCollider.localScale;
     //speedSpinMaxScale = speedSpinMinScale * speedSpinMaxScaleDist;
     //StartCoroutine(WalkSound());
 }
Beispiel #6
0
 private void Start()
 {
     playerMotor            = GetComponent <PlayerMotor>();
     playerHealth           = GetComponent <PlayerHealth>();
     anim                   = GetComponent <Animator>();
     ropeSystem             = GetComponent <RopeSystem>();
     crosshairSprite        = crosshair.GetComponent <SpriteRenderer>();
     thisPlayerInput        = GetComponent <PlayerInput>();
     statutsIndicatorPrefab = playerHealth.damageDisplayPrefab;
 }
Beispiel #7
0
    void Start()
    {
        // get the reference to the player's rope system
        PlayerRopeSystemReference = PlayerReference.GetComponentInChildren <RopeSystem>();

        // set the initial position for the camera
        CameraGrabPos = ActiveMainCamera.transform.position;

        WaterTargetPosition = WaterReference.transform.position;
    }
Beispiel #8
0
 private void Awake()
 {
     if (instnace != null)
     {
         Destroy(this);
     }
     else
     {
         instnace = this;
     }
 }
Beispiel #9
0
    void Start()
    {
        //Get a reference to the required components
        input        = GetComponent <PlayerInput>();
        rigidBody    = GetComponent <Rigidbody2D>();
        bodyCollider = GetComponent <BoxCollider2D>();
        myAnimator   = GetComponent <Animator>();
        shooting     = GetComponent <PlayerShooting>();
        rope         = GetComponent <RopeSystem>();
        sprite       = GetComponent <SpriteRenderer>();

        //Record the original x scale of the player
        originalXScale = transform.localScale.x;
    }
Beispiel #10
0
    private void Start()
    {
        if (GameManager.instance.isInOnlineMultiplayer == false)
        {
            this.enabled = false;
            return;
        }

        spriteRenderer   = GetComponent <SpriteRenderer>();
        playerHealth     = GetComponent <PlayerHealth>();
        playerController = GetComponent <PlayerController>();
        ropeSystem       = GetComponent <RopeSystem>();

        Initialize();
    }
Beispiel #11
0
    private void Pickup(Collider2D player)
    {
        //Spawn Pickup effect
        Instantiate(pickupEffect, transform.position, transform.rotation);
        Debug.Log("Pickup");

        RopeSystem ropeSystem = player.GetComponent <RopeSystem>();

        ropeSystem.ropeMaxDistance += 1f;

        //Apply effect to player


        //Remove
        Destroy(gameObject);
    }
Beispiel #12
0
    // Use this for initialization
    void Start()
    {
        defaultYPos = mainCamera.transform.position.y;
        deathCount  = 0;
        myBody      = this.GetComponent <Rigidbody2D> ();
        myTransform = this.GetComponent <Transform>();
        anim        = GetComponent <Animator>();
        system      = GetComponent <RopeSystem> ();
        source      = GetComponent <AudioSource> ();
        respawnPos  = myTransform.position;
        camUpDown   = mainCamera.GetComponent <CameraUpDown> ();
        GameObject playerScoreObject = GameObject.FindGameObjectWithTag("PlayerScore");

        score        = playerScoreObject.GetComponent <PlayerScore> ();
        thisCollider = this.GetComponent <PolygonCollider2D> ();
    }
Beispiel #13
0
 void Awake()
 {
     if (rs == null)
     {
         rs = this;
     }
     else
     {
         Destroy(this);
     }
     ropeJoint.enabled     = false;
     playerPosition        = transform.position;
     ropeHingeAnchorRb     = ropeHingeAnchor.GetComponent <Rigidbody2D>();
     ropeHingeAnchorSprite = ropeHingeAnchor.GetComponent <SpriteRenderer>();
     playerMovement        = GetComponent <PlayerMovement>();
 }
    // Use this for initialization
    void Start()
    {
        while (lifeCase.Count != 7)
        {
            foreach (GameObject caseLife in GameObject.FindGameObjectsWithTag("Life"))
            {
                if (caseLife.name == ("Case" + index))
                {
                    lifeCase.Add(caseLife);
                    lifeCaseAll.Add(caseLife);
                    index += 1;
                }
            }
        }

        activateOrNotHook = this.GetComponent <RopeSystem>();
    }
Beispiel #15
0
 // Use this for initialization
 void Start()
 {
     if (!m_anim)
     {
         m_anim = GetComponent <Animator>();
     }
     if (swingForce <= 0)
     {
         swingForce = 4.0f;
     }
     if (!rb)
     {
         rb = GetComponent <Rigidbody2D>();
     }
     rs = GetComponent <RopeSystem>();
     if (dashForce <= 0)
     {
         dashForce = 6.0f;
     }
     gravityTier = new float[3] {
         2.5f, 5f, 10f
     };
 }
 // Use this for initialization
 void Start()
 {
     //retrieve the rope systems
     rightRopeSystem = rightRope.GetComponent <RopeSystem>();
     leftRopeSystem  = leftRope.GetComponent <RopeSystem>();
 }
 public CharacterMovementSystem(SystemManager systemManager, EntityManager entityManager)
 {
     _systemManager = systemManager;
     _entityManager = entityManager;
     _ropeSystem = _systemManager.getSystem(SystemType.Rope) as RopeSystem;
 }