Esempio n. 1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Player = animator.GetComponent <PlayerConroller>();

        Player.Drone.gameObject.SetActive(false);
        Player.Character.gameObject.SetActive(false);
    }
Esempio n. 2
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Player = animator.GetComponent <PlayerConroller>();

        Player.Drone.gameObject.SetActive(true);
        Player.Drone.Loaded?.Invoke();
    }
Esempio n. 3
0
    private void WinUI(PlayerConroller pc)
    {
        winobj.SetActive(true);
        var winner = FindObjectsOfType <PlayerConroller>().Except(pc.Yield()).FirstOrDefault();

        winImage.sprite = winner.Image;
    }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     player          = FindObjectOfType <PlayerConroller> ();
     rBody           = GetComponent <Rigidbody2D> ();
     isChargingRight = false;
     isChargingLeft  = false;
 }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType<PlayerConroller> ();
     rBody = GetComponent<Rigidbody2D> ();
     isChargingRight = false;
     isChargingLeft = false;
 }
Esempio n. 6
0
 void Start()
 {
     instance       = this;
     mainCamera     = GetComponentInChildren <Camera>().transform;
     rigidBody      = GetComponent <Rigidbody>();
     playerCollider = GetComponent <Collider>();
     ToggleCursor(false);
 }
Esempio n. 7
0
 void Start()
 {
     wc = GetComponent <WeaponController>();
     playerController = transform.parent.GetComponent <PlayerConroller>();
     colMask          = colMask & ~(1 << playerController.gameObject.layer);
     colMask2         = colMask;
     colMask2         = colMask & ~(1 << LayerMask.GetMask("Ground"));
 }
Esempio n. 8
0
    public void OnCollisionEnter2D(Collision2D collision)
    {
        playerController = collision.gameObject.GetComponent <PlayerConroller>();

        playerController.shot();

        Destroy(gameObject);
    }
Esempio n. 9
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     playerController = collision.gameObject.GetComponent <PlayerConroller>();
     if (collision.gameObject.tag == "Player")
     {
         playerController.Smash();
     }
 }
Esempio n. 10
0
 // Start is called before the first frame update
 public override void Start()
 {
     base.Start();
     controller = GetComponent <PlayerConroller>();
     renderer   = GetComponent <SpriteRenderer>();
     animator   = GetComponent <Animator>();
     FaceRight();
     isJumping = false;
 }
Esempio n. 11
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     playerController = collision.gameObject.GetComponent <PlayerConroller>();
     if (collision.gameObject.tag == "Player")
     {
         playerController.Fall();
         source.PlayOneShot(source.clip);
     }
 }
Esempio n. 12
0
    public override void Execute(float v, PlayerConroller target)
    {
        timer = defaultTimer;
        var go = Instantiate(projectile, this.transform.position, this.transform.rotation);
        var rb = go.GetComponent <Rigidbody2D>();

        parentRb.AddForce(-weaponForce * transform.up, ForceMode2D.Impulse);
        Destroy(go, 5);
    }
Esempio n. 13
0
    public override bool CanExecute(PlayerConroller target)
    {
        if (target.inputBlocked != 0)
        {
            return(false);
        }
        var dist = Vector3.Distance(this.transform.position, target.rbBody.position);

        return(dist < 1.3f);
    }
Esempio n. 14
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     playerController = collision.gameObject.GetComponent <PlayerConroller>();
     if (collision.gameObject.tag == "Player")
     {
         Instantiate(boom, transform.position, Quaternion.identity);
         playerController.Kaboom();
         Destroy(gameObject);
     }
 }
Esempio n. 15
0
 internal void UseWeapon(PlayerConroller other)
 {
     foreach (var spot in weaponSpots)
     {
         if (spot.HasWeapon())
         {
             spot.weapon.Execute(pc.GetCurrentHorizontalForce(), other);
             spot.taken = false;
             break;
         }
     }
 }
Esempio n. 16
0
    private void Start()
    {
        var child1 = gameObject.transform.Find("Arm_R").GetChild(3).gameObject;
        var child2 = gameObject.transform.Find("Arm_L").GetChild(3).gameObject;

        publicSpots.Add(child1);
        publicSpots.Add(child2);
        foreach (var spot in publicSpots)
        {
            var ws = new WeaponSlot();
            ws.go = spot;
            weaponSpots.Add(ws);
        }
        bodyCollider = GetComponent <CircleCollider2D>();
        pc           = bodyCollider.transform.parent.GetComponent <PlayerConroller>();
    }
    void Awake()
    {
        cameraScript     = GetComponent <CameraMovment>();
        controllerScript = GetComponent <PlayerConroller>();

        if (photonView.isMine)
        {
            //MINE: local player, simply enable the local scripts
            cameraScript.enabled     = true;
            controllerScript.enabled = true;
        }
        else
        {
            cameraScript.enabled = false;

            controllerScript.enabled = false;
        }

        gameObject.name = gameObject.name + photonView.viewID;
    }
Esempio n. 18
0
    //End of Variables

    // Use this for initialization
    void Start()
    {
        //Initialize Components
        m_Animator  = GetComponent <Animator>();
        gm          = GameObject.Find("GameManager").GetComponent <GameManager>();
        gunTypeText = GameObject.Find("GunType").GetComponent <Text> ();
        ammoTxt     = GameObject.Find("ammoTxt").GetComponent <Text> ();
        reloadBtn   = GameObject.Find("Reload").GetComponent <Button>();
        player      = gameObject.GetComponent <PlayerConroller> ();

        noGun.SetActive(true);
        FlagState(hasFlag, mapflagstate);

        //Button Listeners
        reloadBtn.onClick.AddListener(() => { Reload(); });          // <-- you assign a method to the button OnClick event here

        //Initialize Weapon Class
        smgCS = new WeaponsClasses.SMG1();
        arCS  = new WeaponsClasses.AR1();
    }
Esempio n. 19
0
    public static void spawnTiles()
    {
        PlayerConroller.deleteDeadBodies();
        destroyDisplayedTiles();
        destroyBackupTiles();
        getObj();
        for (float i = 0.6f; i < lastTileX + 1; i += 2.4f)
        {
            for (float j = 4.2f; j > -0.6f; j -= 1.2f)
            {
                displayedTiles.Add(Instantiate(empty, new Vector2(i, j) + offset, Quaternion.identity));
            }
        }

        for (float i = 1.8f; i < lastTileX + 1; i += 2.4f)
        {
            float randomVer = (float)((int)((Random.Range(0, 3))) * 1.2 + 0.6);
            for (float j = 4.2f; j > -0.6f; j -= 1.2f)
            {
                if (randomVer >= (j - 0.2) && randomVer <= (j + 0.2))
                {
                    displayedTiles.Add(Instantiate(empty, new Vector2(i, j) + offset, Quaternion.identity));
                    tilesBackup.Add(empty);
                }
                else
                {
                    GameObject g = getRandomTile();
                    displayedTiles.Add(Instantiate(g, new Vector2(i, j) + offset, Quaternion.identity));
                    tilesBackup.Add(g);
                }
            }
        }
        Debug.Log(tilesBackup.Count);
        doorOBJ = Instantiate(door, doorPos, Quaternion.identity);
        wallOBJ = Instantiate(wall, wallPos, Quaternion.identity);
    }
Esempio n. 20
0
    private IEnumerator StartGrow(PlayerConroller pc)
    {
        source.Play();
        pc.CanGrow = false;
        AudioSource.PlayClipAtPoint(aclip, Camera.main.transform.position);
        while (pc.GetBodyScale() < maxScale)
        {
            pc.MultiplyScale(growMultiplier);
            pc.MultiplyLines(growMultiplier);
            pc.MultiplyRayLine(growMultiplier);
            yield return(null);
        }

        yield return(new WaitForSeconds(cooldown));

        while (pc.GetBodyScale() > 1)
        {
            pc.MultiplyScale(1 / growMultiplier);
            pc.MultiplyLines(1 / growMultiplier);
            pc.MultiplyRayLine(1 / growMultiplier);
            yield return(null);
        }
        pc.CanGrow = true;
    }
Esempio n. 21
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType<PlayerConroller> ();
 }
Esempio n. 22
0
 public override void Execute(float v, PlayerConroller target)
 {
     AudioSource.PlayClipAtPoint(audioClip, Camera.main.transform.position);
     target.LoseInput(1.5f);
     Destroy(this.gameObject);
 }
Esempio n. 23
0
 public virtual void Affect(PlayerConroller pc)
 {
 }
Esempio n. 24
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType <PlayerConroller> ();
 }
Esempio n. 25
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType<PlayerConroller> ();
     follow = true;
 }
Esempio n. 26
0
 public virtual bool CanExecute(PlayerConroller target)
 {
     return(timer <= 0.0f && parentRb != null);
 }
Esempio n. 27
0
 public virtual void Execute(float v, PlayerConroller target)
 {
 }
Esempio n. 28
0
 public override void Affect(PlayerConroller pc)
 {
     StartCoroutine(StartGrow(pc));
 }
Esempio n. 29
0
 public virtual void Start()
 {
     pl        = GameObject.Find("Player");
     playercon = pl.GetComponent <PlayerConroller> ();
 }
Esempio n. 30
0
 PlayerConroller()
 {
     Instance = this;
 }
Esempio n. 31
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType <PlayerConroller> ();
     follow = true;
 }