Esempio n. 1
0
 void Awake()
 {
     if (!photonView.IsMine && variableJoystick != null)
     {
         variableJoystick = null;
     }
 }
Esempio n. 2
0
 void Start()
 {
     SetUpMovementBoundaries();
     myAudio     = GetComponent <AudioSource>();
     varJoystick = FindObjectOfType <VariableJoystick>();
     shootbutton = FindObjectOfType <ShootButton>();
 }
Esempio n. 3
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        this.myAnimator = GetComponent <Animator>();


        if (myPV.IsMine)    //自キャラであれば実行
        {
            //Keyの取得フラグ
            GamaObj = GameObject.Find("GameObject");
            script  = GamaObj.GetComponent <SimplePun>();

            //ゴールした時のゴールという文字 アニメーションでせりあがる
            GoalGameObj = GameObject.Find("GoalTxt");

            //扉にアタッチしているオープンゲートスクリプト取得
            GateObj        = GameObject.Find("LeftCore");
            opengatescript = GateObj.GetComponent <Opengate>();

            //インスタンスにjoystickを登録
            m_VariableJoystick = GameObject.Find("Variable Joystick").GetComponent <VariableJoystick>();
            m_Rigidbody        = GetComponent <Rigidbody>();

            //ゴールのkey
            m_key_Rigidbody = GameObject.Find("key").GetComponent <Rigidbody>();
            m_key           = GameObject.Find("key");

            audioSource = GetComponent <AudioSource>();
        }
    }
Esempio n. 5
0
 private void Start()
 {
     stick    = GetComponent <VariableJoystick>();
     handle   = transform.GetChild(0).GetChild(0).GetComponent <Image>();
     ss       = SkillState.Idle;
     isActive = false;
 }
Esempio n. 6
0
 // Start is called before the first frame update
 void Start()
 {
     rb = GetComponent <Rigidbody>();
     variableJoystick = FindObjectOfType <VariableJoystick>();
     _playerAnim      = transform.GetChild(0).GetComponent <Animator>();
     _playerAnim.SetBool("idle", true);
 }
Esempio n. 7
0
        private void OnEnable()
        {
            defaultPlayerAnimation = FindObjectOfType <DefaultPlayerAnimation>();
            variableJoystick       = FindObjectOfType <VariableJoystick>();

            currentState = defaultPlayerState;
        }
    /*public float lookSpeed = 10;
     * private Vector3 curLoc;
     * private Vector3 prevLoc;
     * private Vector3 previousLocation;*/

    //public float turnSpeed = 50f;



    void Awake()
    {
        photonview       = GetComponent <PhotonView>();
        variableJoystick = GameObject.FindWithTag("Joystick").GetComponent <VariableJoystick>();
        JumpButton       = GameObject.FindWithTag("JumpButton").GetComponent <Button>();
        FireButton       = GameObject.FindWithTag("FireButton").GetComponent <Button>();
    }
Esempio n. 9
0
    void Start()
    {
        characterController = GetComponent <CharacterController>();
        animator            = GetComponent <Animator>();
        joystick            = GameObject.Find("Variable Joystick").GetComponent <VariableJoystick>();
        state             = ActionState.Idle;
        camera            = GameObject.Find("FirstPersonView").GetComponent <Camera>();
        this.cameraOffset = Camera.main.transform.position - this.transform.position;
        hpControl         = (HealthBarControl)GameObject.FindGameObjectWithTag("HPBar").GetComponent(typeof(HealthBarControl));
        coldControl       = (ManaBarControl)GameObject.FindGameObjectWithTag("ManaBar").GetComponent(typeof(ManaBarControl));
        frostEffect       = GameObject.Find("FirstPersonView").GetComponent <FrostEffect>();

        if (GameManager.instance != null)
        {
            this.hp     = GameManager.instance.hp;
            this.coldHp = GameManager.instance.coldHp;

            hpControl.setValue(this.hp);
            coldControl.setValue(this.coldHp);

            this.transform.position = GameManager.instance.position;
            this.transform.rotation = GameManager.instance.rotation;
        }

        Debug.Log("Start for Player: hp " + this.hp + ", coldHp: " + this.coldHp + ", position: " + this.transform.position
                  + "instance position: " + GameManager.instance.position);
    }
Esempio n. 10
0
    // Setting the controller of this player
    public override void SetController(VariableJoystick joystick, Button button)
    {
        this.joystick = joystick;
        jumpButton    = button;

        jumpButton.onClick.AddListener(ControllerPhysic);
    }
Esempio n. 11
0
    void Start()
    {
        //netmanager = GameObject.Find("GameManager").transform.GetComponent<NetworkGameManager>();
        if (!isLocalPlayer)
        {
            ButtonShoot.SetActive(false);
            print("Button mati");
        }
        _rigidbody = GetComponent <Rigidbody>();
        _collider  = GetComponent <Collider>();

        Renderer[] rends = GetComponentsInChildren <Renderer>();
        foreach (Renderer r in rends)
        {
            r.material.color = color;
        }

        //We don't want to handle collision on client, so disable collider there
        _collider.enabled = isServer;

        variableJoystick = GameObject.Find("Variable Joystick").transform.GetComponent <VariableJoystick>();


        if (NetworkGameManager.sInstance != null)
        {//we MAY be awake late (see comment on _wasInit above), so if the instance is already there we init
            Init();
        }
    }
Esempio n. 12
0
 void Awake()
 {
     _rigidbody             = GetComponent <Rigidbody2D>();
     _joystick              = FindObjectOfType <VariableJoystick>();
     _targetDetector        = GetComponent <TargetDetector>();
     _healthController      = GetComponent <HealthController>();
     _deathScreenController = FindObjectOfType <DeathScreenController>().gameObject;
 }
Esempio n. 13
0
 void Start()
 {
     rb = GetComponent <Rigidbody2D>();
     Physics2D.queriesStartInColliders = false;
     joystick1 = FindObjectOfType <VariableJoystick>();
     target    = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     player    = GameObject.FindGameObjectWithTag("Player").transform;
 }
Esempio n. 14
0
    private void Start()
    {
        VarJoystick = GameObject.FindGameObjectWithTag("VariableJoystick");

        variableJoystick = VarJoystick.GetComponent <VariableJoystick>();

        rb             = GetComponent <Rigidbody2D>();
        GameController = GameObject.FindGameObjectWithTag("GameController");
    }
 public void Start()
 {
     anim = transform.GetChild(0).GetComponent <Animator>();
     // if player is old model
     if (anim == null)
     {
         anim = GetComponent <Animator>();
     }
     variableJoystick = FindObjectOfType <VariableJoystick>();
 }
Esempio n. 16
0
    private void Start()
    {
        var health = GetComponent <IHealth>();

        health.SetHealth(PlayerData.Health);
        health.OutOfHealth += () => Destroy(gameObject);

        _boundary  = new Boundary(Camera.main);
        _joystick  = FindObjectOfType <VariableJoystick>();
        _rigidbody = GetComponent <Rigidbody>();
    }
Esempio n. 17
0
    //public GameObject paddleRef;
    public void Start()
    {
        //variableJoystick = (VariableJoystick)Resources.Load("Assets/Joystick Pack/Prefabs/Variable Joystick.prefab", typeof(VariableJoystick));
        //Object prefab = Resources.Load("Assets/Joystick Pack/Prefabs/Variable Joystick.prefab", typeof(GameObject));
        //paddleRef = (GameObject)prefab;
        //VariableJoystick = prefab;
        variableJoystick = (GameObject)GameObject.Find("reference1");
        reference referenceScript = variableJoystick.GetComponent <reference>();

        variableJoystickXD = referenceScript.variableJoy;
        //variableJoystick = (GameObject)GameObject.FindGameObjectWithTag("joystick1");
    }
Esempio n. 18
0
    void Start()
    {
        int k = 0;

        PlayerPrefs.SetInt("kolvo", k);
        score          = PlayerPrefs.GetInt("Score", score);
        PlayerHealth   = MaxHealth;
        PlayerHealthUI = PlayerHealth;
        joystick1      = FindObjectOfType <VariableJoystick>();
        joystick2      = FindObjectOfType <FixedJoystick>();
        rb             = GetComponent <Rigidbody2D>();
    }
Esempio n. 19
0
    // Use this for initialization
    void Start()
    {
#if UNITY_ANDROID && UNITY_EDITOR
        variableJoystick = GameObject.Find("Camera Joystick").GetComponent <VariableJoystick>();
#else
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
#endif

        Vector3 rot = transform.localRotation.eulerAngles;
        rotY = rot.y;
        rotX = rot.x;
    }
Esempio n. 20
0
    // Start is called before the first frame update
    void Start()
    {
        myAnimator       = GetComponent <Animator>();
        myRigidBody      = GetComponent <Rigidbody2D>();
        myBodyCollider2d = GetComponent <CapsuleCollider2D>();
        myFeet           = GetComponent <BoxCollider2D>();
        GameSession      = FindObjectOfType <GameSession>();
        levelLoader      = FindObjectOfType <LevelLoader>();
        joystick         = FindObjectOfType <VariableJoystick>();
        button           = FindObjectOfType <JoyButton>();

        gravityScaleAtStart = myRigidBody.gravityScale;
    }
Esempio n. 21
0
    // Start is called before the first frame update
    void Start()
    {
        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();
        //  joystick = FindObjectOfType<FixedJoystick>();
        variableJoystick = FindObjectOfType <VariableJoystick>();

        bombCD = attackRate;

        GameManager.GetInstance().SetPlayer(this);

        GameManager.GetInstance().Load(); // 加载玩家数据
    }
    private void Awake()
    {
        player   = GetComponent <Player>();
        joystick = FindObjectOfType <VariableJoystick>();

#if UNITY_ANDROID
#else
        if (joystick)
        {
            Destroy(joystick.gameObject);
        }
#endif
    }
Esempio n. 23
0
    public override void OnStartLocalPlayer()
    {
        base.OnStartLocalPlayer();
        joystick = GameUIController.Ins.joystick;
        var camera = GameObject.FindObjectOfType <CinemachineVirtualCamera>();

        camera.LookAt = transform;
        camera.Follow = transform;
        GetComponent <SpriteRenderer>().color = Color.red;
        Self = this;
        var name = PlayerPrefs.GetString("player_name", "");

        CmdSetName(name.Trim());
    }
Esempio n. 24
0
    // Start is called before the first frame update
    void Start()
    {
        audioSource = GetComponent <AudioSource>();
        m_animator  = GetComponent <Animator>();
        rb          = GetComponent <Rigidbody2D>();

        Vector2 pos;

        pos.x = PlayerPrefs.GetFloat("PosX", -28f);
        pos.y = PlayerPrefs.GetFloat("PosY", -20f);
        transform.position = GameManager.gameMode == 0 ? new Vector2(-28f, -20f) : pos;

        variableJoystick = joy.GetComponent <VariableJoystick>();
    }
Esempio n. 25
0
 // Start is called before the first frame update
 private void Awake()
 {
     jt = GameObject.FindGameObjectWithTag("JoyStick");
     if (instance == null)
     {
         instance = this;
     }
     if (jt != null)
     {
         //joystick = Joystick.FindObjectOfType(Joystick);
         variableJoystick = jt.GetComponent <VariableJoystick>();
     }
     audioManager = AudioManager.instance;
     controller   = GetComponent <CharacterController2D>();
 }
Esempio n. 26
0
 void Start()
 {
     variableJoystick   = FindObjectOfType <VariableJoystick>();
     Actionbutton       = GameObject.Find("ActionButton").GetComponent <Button>();
     Skillanditembutton = GameObject.Find("SkillanduseitemButton").GetComponent <Button>();
     Sitbutton          = GameObject.Find("SitButton").GetComponent <Button>();
     if (Swaprole.chooserole.Role == "Survival")
     {
         //SurvivalAction()
     }
     else
     {
         speed = 7f;
         //HunterAction()
     }
 }
Esempio n. 27
0
    // Use this for initialization
    public override void OnStartAuthority()
    {
        gameObject.tag = "ghostLocal";
        Destroy(parent.GetComponent <CamControl>().cameraGO);
        GameObject cam = Instantiate(cameraGO, transform.position, Quaternion.identity);

        cam.GetComponent <CamFollowAI>().parent = transform;
        joystick = GameObject.Find("RightJ").GetComponent <VariableJoystick>();
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Chunk"))
        {
            if (go.name == "TerrainLoader(Clone)")
            {
                go.GetComponent <ChunkLoad>().local = transform;
            }
        }
    }
Esempio n. 28
0
    private void Start()
    {
        if (Motor == null)
        {
            Debug.LogError("Error Linking Controller System");
            return;
        }

        OrbitCamera = GetComponentInChildren <KIN_Cam>();
        if (isLocal)
        {
            //joystick
            _Joystick = FindObjectOfType <VariableJoystick>();
            if (_Joystick == null)
            {
                Debug.LogError("Joystick not found");
                return;
            }

            // Camera
            OrbitCamera.IgnoredColliders.Clear();
            OrbitCamera.IgnoredColliders.AddRange(gameObject.GetComponents <Collider>());
            //seperate the camera
            OrbitCamera.transform.parent = null;
            OrbitCamera.SetFollowTransform(CameraFollowPoint);


            // instances refrence
            UIManager.Instance.JumpButton.onClick.AddListener(OnJumpPressed);
        }
        else
        {
            gameObject.name = "AI_Player" + gameObject.GetInstanceID();
            GameObject.Destroy(OrbitCamera.gameObject);
        }


        //players stats
        playerstats = GetComponent <Player_Stats>();


        _Combiner = GetComponentInChildren <SkinnedMeshCombiner>();


        // tran to default:
        TransitionToState(CharacterState.Default);
    }
Esempio n. 29
0
// Start is called before the first frame update
    void Start()
    {
// Inicialization of variables
        _joystick            = GameObject.FindGameObjectWithTag("Joystick").GetComponent <VariableJoystick>();
        _bestScore           = PlayerPrefs.GetInt("highscore", _bestScore);
        _pauseButton.enabled = false;

        _bestScoreText.text = "HighScore: " + _bestScore;
// Set displayed lifes
        foreach (Image l in _lifes)
        {
            l.enabled = false;
        }

// Enable joystick usage
        _joystick.enabled = false;
    }
Esempio n. 30
0
 // Start is called before the first frame update
 void Awake()
 {
     jt = GameObject.FindGameObjectWithTag("JoyStick");
     if (instance == null)
     {
         instance = this;
     }
     if (jt != null)
     {
         //joystick = Joystick.FindObjectOfType(Joystick);
         variableJoystick = jt.GetComponent <VariableJoystick>();
     }
     GunPooint = transform.Find("Gunpoint");
     if (GunPooint == null)
     {
         Debug.LogError("NaNI");
     }
 }