public void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     Debug.Log("awake called");
 }
Exemplo n.º 2
0
    void Start()
    {
        skills = new Skill[MarcoPoloGame.SKILL_COUNT];
        PM     = GetComponent <PlayerMovement>();
        PV     = GetComponent <PhotonView>();
        MB     = GameObject.FindObjectOfType <MonoBehaviour>();
        AD     = GameObject.Find("PowerupSound").GetComponent <AudioSource>();

        SkillbarController SB = GameObject.FindObjectOfType <SkillbarController>();

        SB.SH = this;

        statusBar = GameObject.Find("Canvas/Status Bar");

        skills[0] = new SkillFreeze();
        skills[1] = new SkillSlow();
        skills[2] = new SkillFast();
        skills[3] = new SkillEcho();
        // skills[4] = new SkillDash();
    }
Exemplo n.º 3
0
    private void OnCollisionStay2D(Collision2D collision)
    {
        if (collision.gameObject.GetPhotonView() != null)
        {
            bool isOtherHunter = (bool)collision.gameObject
                                 .GetPhotonView()
                                 .Owner
                                 .CustomProperties[MarcoPoloGame.IS_HUNTER];

            if (!isOtherHunter)
            {
                pickedUp = true;
                SkillbarController SC = GameObject.FindObjectOfType <SkillbarController>();
                SC.OnSkillPickup(this.gameObject, skillId);

                this.gameObject.transform.parent     = SC.Skill1.transform;
                this.gameObject.transform.position   = SC.Skill1.transform.position;
                this.gameObject.transform.localScale = new Vector3(30, 30, 1);
                AD.Play();
            }
        }
    }
Exemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        PV = GetComponent <PhotonView>();
        RB = GetComponent <Rigidbody2D>();
        RB.collisionDetectionMode = CollisionDetectionMode2D.Continuous;

        GM       = GameObject.FindObjectOfType <MarcoPoloGameManager>();
        SM       = GameObject.Find("GameManager").GetComponent <ScoreManager>();
        SC       = GameObject.Find("Canvas/Skillbar").GetComponent <SkillbarController>();
        isMoving = false;

        dashTimer = 0.0f;
        isDashing = false;

        if (PV.IsMine)
        {
            variableJoystick = FindObjectOfType <VariableJoystick>();
            joyButton        = FindObjectOfType <JoyButton>();
            charSprite       = transform.GetChild(1);
        }
        currPosition = Vector2.zero;
        lastPosition = Vector2.zero;
    }