void Start() { state = State.Idle; rgbd = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); health = GetComponent <HealthComponent>(); if (player == null) { playerObj = GameObject.Find("Player"); player = playerObj.transform; } playerScript = player.GetComponent <PlayerInputController>(); if (cam == null) { camObject = GameObject.Find("CamBase"); cam = camObject.transform; } abilitiesIndex = new List <int>(); exclamationMark = GetComponentInChildren <SpriteRenderer>(); exclamationMark.enabled = false; // breakGroundPs = GetComponent<ParticleSystem>(); StartCoroutine(WaitForIdle()); }
// Use this for initialization void Start() { input = PlayerTarget.GetComponent<PlayerInputController>(); machine = PlayerTarget.GetComponent<MoodiePlayerMachine>(); controller = PlayerTarget.GetComponent<CustomController>(); target = PlayerTarget.transform; }
void Start() { if (instance != null) { Destroy(this); } else { instance = this; debugScreen = GameObject.Find("Debug Screen"); world = GameObject.Find("World").GetComponent <World>(); screen = DebugScreen.GetInstance(); player = GameObject.Find("Player"); settingMenu = GetComponent <SettingMenu>(); if (MainScene == SceneManager.GetActiveScene().buildIndex) { inputController = PlayerInputController.GetInstance(); } else { inputController = EditInputController.GetInstance(); } WorldInit(); } }
private void OnCollide(Collider2D collider) { IDamageble damageble = collider.GetComponent <IDamageble>(); if (damageble != null) { PlayerInputController player = collider.GetComponent <PlayerInputController>(); if (player != null) { if (!isAlliedForPlayer) { DealDamage(damageble); } } else { IEnemy enemy = collider.GetComponent <IEnemy>(); if (enemy != null) { if (!isAlliedForEnemy) { DealDamage(damageble); } } } } }
protected override void Init() { base.Init(); //get a reference to our input controller playerInputController = new PlayerInputController(); playerInputController.playerCharacter = this; //Create our state controller to manage all our states playerStateController = new PlayerStateController(this); //init player to idle TransitionState(PlayerStates.SpearIdle); //get our hurtboxes hurtBoxController = GetComponentInChildren <HurtBoxController>(); //get our blocking box and set to unactive blockBox = GetComponentInChildren <BlockBox>(); blockBox.ToggleActive(false); //calculate gravity gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); }
private void InitGameObject(GameObject go, Character character) { go.transform.position = GameObjectTool.LogicToWorld(character.position); go.transform.forward = GameObjectTool.LogicToWorld(character.direction); EntityController ec = go.GetComponent <EntityController>(); if (ec != null) { ec.entity = character; ec.isPlayer = character.IsCurrentPlayer; ec.Ride(character.Info.Ride); character.Controller = ec; } PlayerInputController pc = go.GetComponent <PlayerInputController>(); if (pc != null) { if (character.IsCurrentPlayer) { User.Instance.CurrentCharacterObject = pc; MainPlayerCamera.Instance.player = go; pc.enabled = true; pc.character = character; pc.entityController = ec; } else { pc.enabled = false; } } }
void Start() { _deathEffectPrefab = (GameObject)Resources.Load("VFX/Prefabs/DeathEffects/DeathEffect_Prefab"); rigidBody = GetComponent <Rigidbody2D>(); _inputController = transform.GetComponent <PlayerInputController>(); currentState = PlayerStates.Idle; }
public override void OnInteract(PlayerInputController playerInputController) { GameManager.Instance.EnableConsole(); base.OnInteract(playerInputController); }
// Use this for initialization void Start() { input = PlayerTarget.GetComponent <PlayerInputController>(); machine = PlayerTarget.GetComponent <MoodiePlayerMachine>(); controller = PlayerTarget.GetComponent <CustomController>(); target = PlayerTarget.transform; }
void Awake() { rigidbody = GetComponent <Rigidbody>(); collider = GetComponentInChildren <Collider>(); // We really need to discuss the best way to handle colliders. playerInput = GetComponent <PlayerInputController>(); animator = GetComponent <Animator>(); }
//input control & torque calculations protected override void FixedUpdate() { base.FixedUpdate(); if (IsDestroyed || Driver != Player.MainPlayer || Driver.Health.IsDead) { return; } Vector3 torque = new Vector3(); Vector3 controlTorque = Vector3.zero; if (IsEngineStarted) { controlTorque = new Vector3(PlayerInputController.GetInputY() * ForwardRotorMultiplier, 1.0f, -PlayerInputController.GetInputX() * SidewaysRotorMultiplier); } if (!MainRotorDamaged) { torque += (controlTorque * MaxMainRotorForce * _mainRotorVelocity); Rigidbody.AddRelativeForce(Vector3.up * MaxMainRotorForce * _mainRotorVelocity); } if (Vector3.Angle(Vector3.up, transform.up) < 80) { transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, transform.rotation.eulerAngles.y, 0), Time.deltaTime * _mainRotorVelocity * 2); } if (!TailRotorDamaged) { torque -= (Vector3.up * MaxTailRotorForce * _tailRotorVelocity); } Rigidbody.AddRelativeTorque(torque); }
private void _ReleaseObject(int viewId, bool isLeftHand) { PhotonView targetView = PhotonNetwork.GetPhotonView(viewId); transform.SetParent(null); transform.position = targetView.transform.position; if (photonView.IsMine || !PhotonNetwork.IsConnected) { Transform hand = targetView.transform; _rigidbody.useGravity = true; _rigidbody.isKinematic = false; Vector3 forceDirection; if (XRDevice.isPresent) { SteamVR_Behaviour_Pose cache = isLeftHand ? PlayerInputController.GetInstance().GetLeftHand() : PlayerInputController.GetInstance().GetRightHand(); Transform origin = cache.origin ? cache.origin : cache.transform.parent; forceDirection = origin.TransformVector(cache.GetVelocity()); _rigidbody.velocity = forceDirection * 1.5f; } else { forceDirection = hand.forward + hand.up * 0.12f; _rigidbody.AddForce(forceDirection * 2f, ForceMode.Impulse); } } _isHold = false; }
void Start() { rgbd = GetComponent <Rigidbody>(); playerInputController = GetComponent <PlayerInputController>(); uiBar = GetComponent <UIBar>(); hand = GameObject.Find("mixamorig:LeftHand").transform; }
private void Awake() { _rb2d = GetComponent <Rigidbody2D>(); _playerInputController = GetComponent <PlayerInputController>(); _animator = GetComponent <Animator>(); _interactableWatcher = GetComponent <InteractableWatcher>(); }
// Start is called before the first frame update void Awake() { _keyboard = Keyboard.current; _controller = new PlayerInputController(); PlayerInputController.PlayerActions ac = new PlayerInputController.PlayerActions(_controller); ac.SetCallbacks(this); }
void OnTriggerEnter(Collider other) { Debug.Log("OnTriggerEnter"); PlayerInputController playerInputController = other.GetComponent <PlayerInputController>(); if (playerInputController != null && playerInputController.isActiveAndEnabled) { TeleporterDefine td = DataManager.Instance.Teleporters[this.ID]; if (td == null) { Debug.LogErrorFormat("TeleportObject:Character [{0}] Enter Teleporter[{1}}]", playerInputController.character.Info.Name, this.ID); return; } Debug.LogFormat("TeleportObject:Character [{0}] Enter Teleporter [{1}:{2}]", playerInputController.character.Info.Name, td.ID, td.Name); if (td.LinkTo > 0) { if (DataManager.Instance.Teleporters.ContainsKey(td.LinkTo)) { MapService.Instance.SendMapTeleporter(this.ID); } else { Debug.LogErrorFormat("TeleporTer ID:{0} LinkID {1} error!", td.ID, td.LinkTo); } } } }
private void SpawnHuman() { if (SpawnedHumans.Count >= Data.MaxNumberOfHumans) { return; } Vector3 offset = new Vector3(Random.Range(-1.0f, 1.0f), 0, Random.Range(-1.0f, 1.0f)); offset.Normalize(); offset *= Random.Range(0, Data.SpawnRadius); Vector3 spawnPosition = transform.position + offset; if ((PlayerInputController.GetPlayerCarPosition() - spawnPosition).magnitude < 7.0f) { return; } HumanController newHuman = Instantiate(HumanPrefab); newHuman.Init(Data.MaxDistanceFromSpawn, OnHumanDeath); newHuman.transform.SetParent(transform); newHuman.transform.position = spawnPosition; newHuman.transform.position = new Vector3(newHuman.transform.position.x, 0.88f, newHuman.transform.position.z); SpawnedHumans.Add(newHuman); }
void Start() { input = PlayerTarget.GetComponent <PlayerInputController>(); machine = PlayerTarget.GetComponent <PlayerMachine>(); controller = PlayerTarget.GetComponent <SuperCharacterController>(); target = PlayerTarget.transform; }
void Start() { slider.maxValue = health; enemyBase = GetComponent <EnemyBase>(); playerOb = GameObject.Find("Player"); player = playerOb.GetComponent <PlayerInputController>(); }
void Start() { // Put any code here you want to run ONCE, when the object is initialized // From UnityChan locomotion script // Animatorコンポーネントを取得する anim = GetComponent <Animator>(); // CapsuleColliderコンポーネントを取得する(カプセル型コリジョン) col = GetComponent <CapsuleCollider>(); rb = GetComponent <Rigidbody>(); //メインカメラを取得する cameraObject = GameObject.FindWithTag("MainCamera"); // CapsuleColliderコンポーネントのHeight、Centerの初期値を保存する orgColHight = col.height; orgVectColCenter = col.center; // From PlayerMachine input = gameObject.GetComponent <PlayerInputController>(); // Grab the controller object from our object controller = gameObject.GetComponent <SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; }
private void Start() { _instance = this; AvatarView = GetComponent <AvatarView>(); if (Application.platform == RuntimePlatform.Android) { _playerState = new AndroidPlayerState(this); } else { if (XmlSceneManager.Instance.ControlMode == XmlSceneManager.ControlModeEnum.PcControl) { _playerState = new PcPlayerState(this); } else { _playerState = new AndroidPlayerState(this); } } _deadState = new DeadState(this); _currentState = _playerState; _characterController = GetComponent <CharacterController>(); _clickPointAuxiliaryPrefab = AssetTool.LoadAsset_Database_Or_Bundle( AssetTool.Assets__Resources_Ours__Prefabs_ + "AuxiliaryPrefabs/ClickPointAuxiliary.prefab", "Prefabs", "auxiliaryprefabs_bundle", "ClickPointAuxiliary"); _clickPointObject = Instantiate(_clickPointAuxiliaryPrefab) as GameObject; }
// Start is called before the first frame update void Start() { //TODO check for maxPlayers for (int i = 0; i < CountPlayers; i++) { var playerInput = Instantiate(PlayerInput); PlayerInputController playerInputController = playerInput.GetComponent <PlayerInputController>(); if (i == 0) { playerInputController.Forward = PLAYER_1_UP; playerInputController.Left = PLAYER_1_LEFT; playerInputController.Right = PLAYER_1_RIGHT; playerInputController.Down = PLAYER_1_DOWN; var car = Instantiate(Car, CarSpawn1); playerInputController.Car = car; } if (i == 1) { playerInputController.Forward = PLAYER_2_UP; playerInputController.Left = PLAYER_2_LEFT; playerInputController.Right = PLAYER_2_RIGHT; playerInputController.Down = PLAYER_2_DOWN; var car = Instantiate(Car, CarSpawn2); playerInputController.Car = car; } } }
// Use this for initialization void Start() { input = PlayerTarget.GetComponent<PlayerInputController>(); machine = PlayerTarget.GetComponent<PlayerMachine>(); controller = PlayerTarget.GetComponent<SuperCharacterController>(); target = PlayerTarget.transform; }
void Start() { playerInputController = GetComponent <PlayerInputController>(); defaultStation = GetComponent <NoStationMovement>(); currentStation = defaultStation; currentStation.Inject(playerInputController); }
public void WithdrawControl(PlayerInputController player) { if (controllingPlayer == player) { controllingPlayer = null; } }
private void Start() { DeckBuilderCanvas.gameObject.SetActive(false); AvailableCards = new List <SelectableCard>(); CurrentCards = new List <SelectableCard>(); _playerController = FindObjectOfType <PlayerController>(); _playerInputController = FindObjectOfType <PlayerInputController>(); }
void OnTriggerEnter2D(Collider2D other) { var p = other.GetComponent<PlayerInputController>(); if (!entrance.closed && p) { player = p; StartCoroutine(IntroSequence()); } }
private static PlayerInputController GetInstance() { if (instance == null) { instance = FindObjectOfType <PlayerInputController>(); } return(instance); }
// Use this for initialization void Start() { playerBox = GameGlobalData.player.GetComponent <PlayerColliderBox>(); player = GameGlobalData.player; AttackDelta = 5f; curDeltaTime = 0f; waitTime = 5f; StartCoroutine(Wait()); }
// Use this for initialization void Start() { if(m_playerTarget != null) { input = m_playerTarget.GetComponent<PlayerInputController>(); machine = m_playerTarget.GetComponent<PlayerMachine>(); controller = m_playerTarget.GetComponent<SuperCharacterController>(); } }
void Start() { loseText = loseState.GetComponent <TMPro.TMP_Text>(); loseImg = loseState.GetComponentInChildren <Image>(); cam = Camera.main; imgfx = cam.GetComponent <ImageEffect>(); playerScript = GetComponent <PlayerInputController>(); audioManager = FindObjectOfType <AudioManager>(); }
private void Awake() { pic = GetComponent <PlayerInputController>(); if (pic != null && player != null && field != null) { pic.player = player; player.SetBounds(field.GetBounds()); } }
// Start is called before the first frame update void Awake() { thisBounds = new Bounds(); thisCamera = GetComponent <Camera>(); currentCanvas = FindObjectOfType <Canvas>(); thisInputController = FindObjectOfType <PlayerInputController>(); rb = GetComponent <Rigidbody2D>(); activeNode = NearestNode(Vector2.zero); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Bullet") { PlayerInputController player = other.transform.parent.GetComponent <BulletMovement> ().yDir == 1 ? GameManagers.gameModel.controller.player1 : GameManagers.gameModel.controller.player2; applyItem(player); Destroy(gameObject); } }
void Start () { // Put any code here you want to run ONCE, when the object is initialized input = gameObject.GetComponent<PlayerInputController>(); // Grab the controller object from our object controller = gameObject.GetComponent<SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; }
void Start() { player = GameControl.instance.player; input = player.GetComponent<PlayerInputController>(); machine = player.GetComponent<PlayerMachine>(); controller = player.GetComponent<SuperCharacterController>(); target = player.transform; // Set the look direction based on the initial rotation of the player lookDirection = Quaternion.AngleAxis(machine.InitialRotation, controller.up) * Vector3.forward; distance = (minDistance + maxDistance) / 2; }
// Use this for initialization void Start() { if( Instance == null ){ Instance = this; }else if( Instance != null ){ Destroy(this); } input = PlayerTarget.GetComponent<PlayerInputController>(); machine = PlayerTarget.GetComponent<PlayerMachine>(); controller = PlayerTarget.GetComponent<SuperCharacterController>(); target = PlayerTarget.transform; onSpin = false; continueRotation = 1.0f; }
void Start() { // Put any code here you want to run ONCE, when the object is initialized weaponList = new IWeapon[]{ new NetBehaviour( gameObject,hittable ), new SwordBehaviour(gameObject,hittable) }; mWeapon = weaponList[0]; input = gameObject.GetComponent<PlayerInputController>(); anims = new AnimState[]{ new idleAnimState(),new runAnimState(),new jumpAnimState(),new doubleJumpAnimState(),new climbAnimState(),new fallAnimState() }; currentAnimState = anims[0]; // Grab the controller object from our object controller = gameObject.GetComponent<SuperCharacterController>(); // Our character's current facing direction, planar to the ground lookDirection = transform.forward; // Set our currentState to idle on startup currentState = PlayerStates.Idle; }
void Start() { controller = gameObject.GetComponent<SuperCharacterController>(); input = gameObject.GetComponent<PlayerInputController>(); cam = GameControl.instance.mainCamera.GetComponent<PlayerCamera>(); anim = AnimatedMesh.GetComponent<Animator>(); // Our character's current facing direction, planar to the ground artForwardDirection = Quaternion.AngleAxis(InitialRotation, controller.up) * Vector3.forward; artUpDirection = controller.up; AnimatedMesh.rotation = Quaternion.LookRotation (artForwardDirection, artUpDirection); // Set our currentState to idle on startup currentState = PlayerStates.Idle; RunSpeed = MoveSpeed * 0.4f; RunSmokeEffect.enableEmission = false; doubleJump = false; }
private void Awake() { //get Suimono Specific Objects suimonoGameObject = GameObject.Find("SUIMONO_Module"); if (suimonoGameObject != null) suimonoModuleObject = suimonoGameObject.GetComponent<SuimonoModule>(); targetPosition = cameraTarget.position; targetRotation = cameraTarget.rotation; if (cameraTarget != null) { targetAnimator = cameraTarget.gameObject.GetComponent<PlayerAnimController>(); } //if (vehicleTarget != null){ // vehiclePosition = vehicleTarget.gameObject.Find("PlayerPositionMarker").transform; // vehicleExitPosition = vehicleTarget.gameObject.Find("PlayerExitMarker").transform; // vehicle_engine_object = vehicleTarget.gameObject.GetComponent(sui_demo_boatAnim) as sui_demo_boatAnim; //} if (buoyancyTarget != null) { buoyancyObject = buoyancyTarget.GetComponent<fx_buoyancy>(); } MC = this.gameObject.GetComponent<PlayerControllerMaster>(); IC = this.gameObject.GetComponent<PlayerInputController>(); }
void SetKeyType1(PlayerInputController controller) { controller.SetKeyIdentifiers(Keys.W, Keys.S, Keys.A, Keys.D, Keys.Space); }
void SetKeyType2(PlayerInputController controller) { controller.SetKeyIdentifiers(Keys.Up, Keys.Down, Keys.Left, Keys.Right, Keys.Enter); }
public void spawnMe(Vector3 pos) { if(myTank == null){ //GameObject cF = Instantiate(cameraFocus, pos, Quaternion.identity) as GameObject; GameObject tank = Instantiate(playerTankPrefab, pos, Quaternion.identity) as GameObject; //tank.GetComponent<Hovercraft>().SetFocus(cF); myTank = tank; myTank.GetComponent<NetTag>().Id = myId + "-00-" + "00"; updatePhysList(); localController = GetLocalController(); spawned = true; } else{ //move to spawn location myTank.GetComponent<Hovercraft>().respawn(pos); spawned = true; } }
// Use this for initialization void Start() { input = GetComponent<PlayerInputController>(); controller = GetComponent<CharacterController>(); walkstate = new WalkState(this , PathLines); jumpState = new JumpState(this); fallState = new FallState(this); currentState = walkstate; currentState.enter_State(); animator = GetComponent<Animator>(); targetPath = PathLines[1]; changePath = false; }
private void Awake() { instance = this; //get Suimono Specific Objects suimonoGameObject = GameObject.Find("SUIMONO_Module"); if (suimonoGameObject != null) suimonoModuleObject = suimonoGameObject.GetComponent<SuimonoModule>(); SetTarget(cameraTarget); //if (vehicleTarget != null){ // vehiclePosition = vehicleTarget.gameObject.Find("PlayerPositionMarker").transform; // vehicleExitPosition = vehicleTarget.gameObject.Find("PlayerExitMarker").transform; // vehicle_engine_object = vehicleTarget.gameObject.GetComponent(sui_demo_boatAnim) as sui_demo_boatAnim; //} MC = this.gameObject.GetComponent<PlayerControllerMaster>(); IC = this.gameObject.GetComponent<PlayerInputController>(); }
/// <summary> /// Initialise a level /// </summary> /// <param name="onWin">Function to call when a player wins (parameter is winning player index)</param> /// <param name="onTie">Function to call when there's a tie</param> public Level(Action<int> onWin, Action onTie) { this.onWin = onWin; this.onTie = onTie; aesthetics = new LevelAesthetics(); tileObjectManager = new TileObjectManager(this); fireManager = new FireManager(tileObjectManager); solidArea = new bool[GlobalGameData.gridSizeX, GlobalGameData.gridSizeY]; gridNodeMap = new GridNodeMap(); playerToController = new Dictionary<int, int>(); players = new Player[4]; //Initialise players to the gridnodemap, with their index, and the bomb create function for (int i = 0; i < 4; ++i) { players[i] = new Player(gridNodeMap, i, tileObjectManager.CreateBomb); } playerInputControllers = new PlayerInputController[4]; //Initialise player input controllers to the players for (int i = 0; i < 4; ++i) { playerInputControllers[i] = new PlayerInputController(players[i]); } floatingAnimationManager = new FloatingAnimationManager(); }