public void Initialize(BaseMotor motor, AbilityList abilities, AnimationSync animations, bool isOnServer) { Motor = motor; Abilities = abilities; Animations = animations; IsOnServer = isOnServer; }
private void Awake() { charController = GetComponent <CharacterController>(); walkingMotor = GetComponent <WalkingMotor>(); fallingMotor = GetComponent <FallingMotor>(); startMotor = GetComponent <StartMotor>(); }
void Start() { _motor = _bodyIdentity.gameObject.GetComponent <BaseMotor>(); _abilities = _bodyIdentity.gameObject.GetComponent <AbilityList>(); _animationSync = _bodyIdentity.gameObject.GetComponent <AnimationSync>(); if (isServer) { _abilities.GrantAbility(new AbilityJump(_motor, _animationSync), AbilitySlot.Jump); _abilities.GrantAbility(new AbilityBasicAttack(_motor, _animationSync), AbilitySlot.Attack1); } }
private void Start() { _windCenter = GameObject.FindGameObjectWithTag("WindCenter"); _storm = _windCenter.GetComponent <Storm>(); _windDirection = _storm.GetComponent <WindDirection>(); _windForce = _storm.GetComponent <WindForce>(); _stormCloud = _storm.stormCloud; _player = GameObject.FindGameObjectWithTag("Player"); _baseMotor = _player.GetComponent <BaseMotor>(); _inGameMenu = GameObject.FindGameObjectWithTag("GameUI").GetComponent <InGameMenu>(); _findIslandOrigins(); _setUpPortals(); _inGameMenu.UpdateText(); Invoke(nameof(_activateCurrentPortal), countdownTilPortalActive); }
public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId) { int playerNumber = GetPlayerNumber(conn); Debug.Log("Player joined. Assigning id: " + playerNumber); var playerObj = (GameObject)Instantiate(playerPrefab, Vector3.zero, Quaternion.identity); Player player = playerObj.GetComponent <Player>(); // -------------- Player Body -------------- // //Spawn the body of the player. Vector3 spawnPoint = new Vector3(0, 5, 11); //TODO Get the prefab from somewhere that makes sense. GameObject bodyPrefab = spawnPrefabs[0]; GameObject playerBody = Instantiate(bodyPrefab, spawnPoint, Quaternion.identity) as GameObject; BaseMotor motor = playerBody.GetComponent <BaseMotor>(); UnitShell shell = playerBody.GetComponent <UnitShell>(); //TODO Load abilities from this too? shell.UnitPrefabToLoad = "Spawnable/Characters/WarriorPrincess"; motor.Initialize(Player.MoveSpeed); NetworkServer.Spawn(playerBody); // -------------- Player -------------- // player.Initialize(playerNumber, playerBody.GetComponent <NetworkIdentity>()); _players.Add(playerNumber, player); //Spawn on network. NetworkServer.AddPlayerForConnection(conn, playerObj, playerControllerId); }
public virtual void Construct() { motor = GetComponent <BaseMotor>(); levelManager = GameObject.FindGameObjectWithTag("LevelManager").GetComponent <LevelManager>(); }
public virtual void Construct() { motor = GetComponent <BaseMotor>(); }
private void Awake() { motor = GetComponent <BaseMotor>(); }
public SuperJumpSpell() { cooldown = 3f; lastCast = float.MinValue; // 0; // should be the same for initialization and allowing first cast straight away - and throws no exception Time.time - cooldown; motor = GetComponent<BaseMotor>(); }
public AbilityJump(BaseMotor caster, AnimationSync animSync) : base(caster, animSync, Cooldown) { }
public virtual void Init() { motor = GetComponent <BaseMotor>(); }
public virtual void Construct() { motor = GetComponent<BaseMotor>(); }
public BaseAbility(BaseMotor caster, AnimationSync animSync, float cooldown) { _caster = caster; _animSync = animSync; _cooldown = cooldown; }
public AbilityBasicAttack(BaseMotor caster, AnimationSync animSync) : base(caster, animSync, Cooldown) { }