Example #1
0
 public ChaseTask(PlayerCTRL player, Enemy character)
 {
     _completed           = false;
     _player              = player;
     _character           = character;
     _initialSpotLocation = new Vector2(_character.transform.position.x, _character.transform.position.y);
 }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     instance      = this;
     this.cur_tool = ToolType.empty;
     sr            = this.GetComponentInChildren <SpriteRenderer>();
     animator      = this.GetComponent <Animator>();
 }
Example #3
0
        public void AddEntityToList(PlayerCTRL entity)
        {
            if (_mListOfPlayers == null)
            {
                _mListOfPlayers = new List <PlayerCTRL>();
            }

            _mListOfPlayers.Add(entity);
        }
Example #4
0
    public void Execute()
    {
        if (MyClonePC != null)
        {
            return;
        }

        MyClonePC = UPlayer.CreateClone(this.transform.position);
        UPlayer.GetComponentInParent <PlayerCTRL>().SetUserControlEnabled(false);
        UPlayer.PossessClone(MyClonePC);
        _cameraController.FollowPlayer(true);
    }
    void Start()
    {
        rb   = GetComponent <Rigidbody2D> ();
        sr   = GetComponent <SpriteRenderer> ();
        anim = GetComponent <Animator> ();

        if (instance == null)
        {
            instance = this;
        }

        if (PlayerPrefs.GetInt("BPU") == 1)
        {
            canFire = true;
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log("Ledge Hit");
        if (other.gameObject.tag == "Player")
        {
            _mPlayerCTRL = other.gameObject.GetComponent <PlayerCTRL>();
            if (_mPlayerCTRL != null)
            {
                _mPlayerCTRL.SetPossessed(true);
                _mPlayerRigidBdy                = _mPlayerCTRL.GetComponent <Rigidbody>();
                _mPlayerRigidBdy.velocity       = Vector3.zero;
                _mPlayerCTRL.transform.position = _mClimbStartPos;
                _mPlayerCTRL.SetFacingDir(CharacterFacing.FACE_CENTRE);
                _mPlayerHeight = _mPlayerCTRL.GetComponent <CapsuleCollider>().height;

                _mClimbUpPos    = transform.position;
                _mClimbUpPos.y += 0.5f + (_mPlayerHeight / 2);

                _mClimbSidePos    = _mClimbUpPos;
                _mClimbSidePos.x += _mLedgeDirection == LedgeAttachment.CLIMB_LEFT ? -1 : 1;
            }
        }
    }
 void Start()
 {
     playerctrl = player.GetComponent <PlayerCTRL> ();
 }
Example #8
0
 void Awake()
 {
     playerMovement = GetComponent <PlayerCTRL> ();
     currentHealth  = startingHealth;
     currentExp     = startingEXP;
 }
 private void ReleasePlayer()
 {
     Debug.Log("Releasing");
     _mPlayerCTRL.SetPossessed(false);
     _mPlayerCTRL = null;
 }
Example #10
0
 void Start()
 {
     Playercon = GameObject.Find("Player(Clone)").GetComponent <PlayerCTRL> ();
 }
Example #11
0
    void FixedUpdate()
    {
        if (_mIsPossessed)
        {
            return;
        }

        if (gameObject.GetComponent <UniquePlayerCTRL>() == null)
        {
            // Allow clones to kill themselves
            if (Input.GetKeyDown(KeyCode.K))
            {
                gameObject.GetComponent <BloodDeath>().Bleed();
                GameObject.Find("DataPacket").GetComponent <PickupUSB>().DropItem();
                GameObject tempRef           = gameObject;
                int        indexOfThisEntity = GameManager.Instance().GetListOfEntities().IndexOf(tempRef.GetComponent <PlayerCTRL>());
                GameManager.Instance().GetListOfEntities().Remove(tempRef.GetComponent <PlayerCTRL>());
                Destroy(tempRef, 0.0f);

                PlayerCameraController camera = FindObjectOfType <PlayerCameraController>();

                PlayerCTRL lastControlled = GameManager.Instance().GetListOfEntities()[indexOfThisEntity - 1];
                lastControlled.SetUserControlEnabled(true);
                camera.SetTargetPlayerObject(lastControlled);
                return;
            }
        }

        // artificial gravity stronger than regular gravity
        _mRigidBody.AddForce(Vector3.down * 20.0f * _mRigidBody.mass);

        if (_mIsAtTerminal)
        {
            return;
        }

        if (!_mIsControlledByUser)
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            List <Lift>     lifts     = FindObjectsOfType <Lift>().OfType <Lift>().ToList();
            List <Switch>   switches  = FindObjectsOfType <Switch>().OfType <Switch>().ToList();
            List <Fusebox>  fuseboxes = FindObjectsOfType <Fusebox>().OfType <Fusebox>().ToList();
            List <Terminal> terminals = FindObjectsOfType <Terminal>().OfType <Terminal>().ToList();

            foreach (Lift lift in lifts)
            {
                lift.Travel(this, transform);
            }


            foreach (Switch button in switches)
            {
                button.Press(transform);
            }

            foreach (Fusebox fuse in fuseboxes)
            {
                fuse.Press(transform);
            }

            foreach (Terminal terminal in terminals)
            {
                terminal.Press();
            }
        }

        float leftRight = CalcLeftRightMovement();

        if (leftRight != 0)
        {
            _mFacingDirection = leftRight > 0 ? CharacterFacing.FACE_RIGHT : CharacterFacing.FACE_LEFT;
            _mRigidBody.MovePosition(this.transform.position + (new Vector3(leftRight * _mMoveForce, 0.0f, 0.0f) * Time.deltaTime));

            AnimatorChangeState(1);
            if (_mFacingDirection == CharacterFacing.FACE_LEFT)
            {
                SpriteRenderer spriteRender = GetComponent <SpriteRenderer>();
                spriteRender.flipX = true;
            }
            else
            {
                SpriteRender.flipX = false;
            }
        }
        else
        {
            AnimatorChangeState(0); //Idle
        }
    }
Example #12
0
 void Start()
 {
     playerctrl = player.GetComponent <PlayerCTRL> ();
     mat        = GetComponent <Renderer>().material;
 }
Example #13
0
 public void SetTargetPlayerObject(PlayerCTRL newTarget)
 {
     _mPlayerController = newTarget;
 }