Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            CamManager cameraManager = GameCamera.GetComponent <CamManager>();

            Transform cameraTarget = cameraManager.Target;

            int      index;
            spider[] insects = GameObject.FindObjectsOfType <spider>();

            if (cameraTarget == null)
            {
                index = 0;
            }
            else
            {
                index = Array.FindIndex(insects, insect => insect.transform == cameraTarget);
                index++;
                if (index == insects.Length)
                {
                    index = 0;
                }
            }

            cameraManager.SetTarget(insects[index].transform);
        }
        if (Input.GetKeyDown(KeyCode.C))
        {
            ToggleColliderVisible();
        }
    }
Ejemplo n.º 2
0
    private void activateSpectatingMode()
    {
        Yes.SetActive(false);
        No.SetActive(false);

        transform.GetChild(0).gameObject.SetActive(true);
        ReadyGUI.GetComponent <Text>().text = "Spectating . . .";
        PercentReady.text = "";
        for (int i = 0; i < RoomSlotImages.Length; i++)
        {
            RoomSlotImages[i].transform.gameObject.SetActive(false);
        }

        CamManager.SetTarget(null);
    }
    void Awake()
    {
        isFrozen = false;
        //DontDestroyOnLoad(gameObject);
        anim            = GetComponentInChildren <Animator>();
        moveRight       = 0;
        moveLeft        = 0;
        controlsPaused  = false;
        myAudioSrc      = GetComponent <AudioSource>();
        myAudioSrc.clip = DeathNoise;
        punching        = false;

        isDead        = false;
        StrengthsList = GameObject.FindGameObjectWithTag("Master").
                        GetComponent <Master>().GetStrengthList();

        CBUG.Log("Str List: " + StrengthsList.ToStringFull());
        jumpForceTemp      = 0f;
        SpeedTemp          = 0f;
        attackDisableDelay = new WaitForSeconds(AttackLife);
        facingRight        = true;
        position           = new Vector2();
        _Rigibody2D        = GetComponent <Rigidbody2D>();
        jumpsRemaining     = TotalJumpsAllowed;
        _PhotonView        = GetComponent <PhotonView>();
        _PhotonTransform   = GetComponent <PhotonTransformView>();

        AttackObjs    = new GameObject[3];
        AttackObjs[0] = transform.GetChild(3).gameObject;
        AttackObjs[1] = transform.GetChild(1).gameObject;
        AttackObjs[2] = transform.GetChild(2).gameObject;

        _MobileInput = GameObject.FindGameObjectWithTag("MobileController").GetComponent <MobileController>();

        spawnPause     = 0.5f;
        spawnPauseWait = new WaitForSeconds(spawnPause);

        lastHitBy           = -1;
        lastHitTime         = Time.time;
        lastHitForgetLength = 5;//Seconds

        if (_PhotonView.isMine)
        {
            tag = "PlayerSelf";
            _PhotonView.RPC("SetSlotNum", PhotonTargets.All, NetIDs.PlayerNumber(PhotonNetwork.player.ID));
            CamManager.SetTarget(transform);
        }
    }
Ejemplo n.º 4
0
 public void SetNewTarget()
 {
     CamManager.SetTarget(transform);
     GameHUDController.SetDamageTo(damage);
 }