// Start is called before the first frame update void Start() { navMeshAgent = GetComponent <NavMeshAgent>(); anim = GetComponentsInChildren <Animator>(); layerPlayer = LayerMask.GetMask("ENEMY"); moveCtrl = GetComponent <MoveCtrl>(); }
public void StartGame() { //Initialize the deck controller DeckMng = GetComponent<DeckManager>(); if (DeckMng == null) DeckMng = gameObject.AddComponent<DeckManager>(); DeckMng.Init(); //Initialize the move controller MoveCtrl = GetComponent<MovesController>(); if (MoveCtrl == null) MoveCtrl = gameObject.AddComponent<MovesController>(); MoveCtrl.Init(); //Initialize the interface controller InterfaceCtrl = FindObjectOfType<InterfaceController>(); InterfaceCtrl.Init(); //Initialize the MoveController with the avaiable decks List<DeckController> decks = new List<DeckController>(); decks.Add(DeckMng.DeckDrawnCards); decks.AddRange(DeckMng.DecksColumn); decks.AddRange(DeckMng.DecksSeed); MovesCalculator.Init(decks); }
private void InteractionSourceUpdated(InteractionSourceUpdatedEventArgs obj) { if (obj.state.source.handedness == Handedness & obj.state.grasped & !previousGraspedCondition) { //Debug.Log("grasped:" + obj.state.grasped); previousGraspedCondition = true; } if (obj.state.source.handedness == Handedness & !obj.state.grasped & previousGraspedCondition) { //Debug.Log("grasped:" + obj.state.grasped); player = GameObject.Find("Player - MRCP"); player_move_script = player.GetComponent <MoveCtrl>(); if (player_move_script.moveSpeed == 0) { player_move_script.moveSpeed = 1.0f; } else { player_move_script.moveSpeed = 0.0f; } previousGraspedCondition = false; } }
// Use this for initialization void Start() { _animation = GetComponentInChildren <Animation> (); _animation.clip = anim.idle; _animation.Play(); _moveCtrl = GetComponent <MoveCtrl> (); }
private void Onestart() { player = GameObject.FindGameObjectWithTag("ROBO"); playerEquipPoint = GameObject.FindGameObjectWithTag("EquipPoint"); playerTakeDownPoint = GameObject.Find("TakeDownPoint"); playerFunction = player.GetComponent <MoveCtrl>(); }
void Awake() { MoveInfo = GetComponent <MoveCtrl>(); // TODO: math screen size AddGroundBlock(false); AddGroundBlock(false); }
// Use this for initialization void Start() { player = GetComponent <Tank> (); identity = GetInstanceID(); move = (MoveCtrl)FindObjectOfType(typeof(MoveCtrl)); btn = GameObject.Find("Attack").GetComponent <Button>(); btn.GetComponent <Button>().onClick.AddListener(delegate() { this.attackHandler(); }); }
public void Init() { Parry.getInstance().init(this); PlayerAction.getInstance().init(); _moveCtrl = this.GetComponent <MoveCtrl>(); // 在 GameManager 的 init 阶段初始化 utils _pos = utils.getInstance().getPlayerPosition(); _moveCtrl.setPosition(_pos); _moveCtrl.setOwner(this); switchGestureToMove(); setState(PlayerState.Idle); }
//=================================================================================================================== private IEnumerator Start() { //Try to GET the current time. WWW www = new WWW(URL); yield return(www); //If get fails, try again every 3 seconds. while (!string.IsNullOrEmpty(www.error)) { yield return(new WaitForSeconds(3)); www = new WWW(URL); yield return(www); } //Get some components. GameObject g = GameObject.FindWithTag("Player"); move = g.GetComponent <MoveCtrl>(); blur = g.GetComponentInChildren <UnityStandardAssets.ImageEffects.BlurOptimized>(); // Prepare received data. TimeJson timeJson = new TimeJson(); JsonUtility.FromJsonOverwrite(www.text, timeJson); //Unix timestamp is seconds past epoch System.DateTime dtDateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); string currentDate = dtDateTime.AddSeconds(timeJson.timestamp - timeJson.gmtOffset).ToLocalTime().ToString(); //Set up current time and end time. System.DateTime currentTime = System.DateTime.Parse(currentDate); System.DateTime startTime = new System.DateTime(1991, 5, 8, 15, 15, 0); //Build the first room. GameObject r = Instantiate(roomPrefab, Vector3.zero, Quaternion.identity) as GameObject; RoomCtrl rCtrl = r.GetComponent <RoomCtrl>(); rCtrl.setEndTime(startTime.AddYears(1), currentTime); rCtrl.setName(0); //Pass the current time to the time controller, it'll take it from here. GetComponent <TimeCtrl>().setCurrentTime(currentTime); //Tell the UI that we are ready, we can start the game. GameObject.FindWithTag("UI").GetComponent <UICtrl>().Ready = true; }
public void PlayerMove() { float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); if ((Mathf.Abs(v) < minResponseVal && Mathf.Abs(h) < minResponseVal)) { MoveCtrl.ResetState(); AnimMgr.Reset(); curState = PlayerState.Idle; } else { curState = PlayerState.Move; MoveCtrl.Move(h * speed, v * speed); AnimMgr.PlayRun(); } }
// Use this for initialization void Start() { DontDestroyOnLoad(gameObject); DontDestroyOnLoad(GameObject.Find("UI Root")); DontDestroyOnLoad(GameObject.Find("Main Camera")); DontDestroyOnLoad(new GameObject("Monster")); DontDestroyOnLoad(new GameObject("Player")); DontDestroyOnLoad(new GameObject("Npc")); DontDestroyOnLoad(new GameObject("Timer")); LEngine.ma = this; LEngine.em = new EventManager(); LEngine.sm = new SceneManager(); LEngine.rm = new ResManager(); _mc = new MoveCtrl(); _mac = new MainCtrl(); _km = new KeyManager(); LEngine.sm.InitScene(); }
public void LoadResources() { //role roleControllers = new RoleCtrl[6]; for (int i = 0; i < 6; ++i) { roleControllers[i] = new RoleCtrl(); roleControllers[i].CreateRole(Position.role_shore[i], i < 3 ? true : false, i); } //shore leftShoreController = new ShoreCtrl(); leftShoreController.CreateShore(Position.left_shore); leftShoreController.GetShore().shore.name = "left_shore"; rightShoreController = new ShoreCtrl(); rightShoreController.CreateShore(Position.right_shore); rightShoreController.GetShore().shore.name = "right_shore"; //将人物添加并定位至左岸 foreach (RoleCtrl roleController in roleControllers) { roleController.GetRoleModel().role.transform.localPosition = leftShoreController.AddRole(roleController.GetRoleModel()); } //boat boatController = new BoatCtrl(); boatController.CreateBoat(Position.left_boat); //river river = new River(Position.river); //move moveController = new MoveCtrl(); isRunning = true; time = 60; }
private void Awake() { EventMgr.UnitBirthEvent.AddListener(Init); Instance = this; }
private MoveCtrl player_move_script; // = player.GetComponent<MoveCtrl>(); private void Start() { player = GameObject.Find("Player - MRCP"); player_move_script = player.GetComponent <MoveCtrl>(); //fire.SetActive(false); }
void Awake() { moveCtrl = GetComponent <MoveCtrl>(); rb = GetComponent <Rigidbody>(); }
void Start() { controller = GameObject.Find("[CameraRig]").GetComponent <MoveCtrl>(); }
// Use this for initialization void Start() { parentScript = this.transform.parent.GetComponent <MoveCtrl>(); }
private MoveCtrl move; //The movement script, for step sound queues. //=================================================================================================================== private void Start() { StartCoroutine(FadeInSound()); move = GameObject.FindWithTag("Player").GetComponent <MoveCtrl>(); ambientSounds = new AudioSource[] { humSound, windSound, howlSound }; }