Example #1
0
 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>();
 }
Example #3
0
    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);
        }
    }
Example #4
0
    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);
    }
Example #5
0
    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);
    }
Example #6
0
 public virtual void Construct()
 {
     motor        = GetComponent <BaseMotor>();
     levelManager = GameObject.FindGameObjectWithTag("LevelManager").GetComponent <LevelManager>();
 }
Example #7
0
 public virtual void Construct()
 {
     motor = GetComponent <BaseMotor>();
 }
Example #8
0
 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>();
 }
Example #10
0
 public AbilityJump(BaseMotor caster, AnimationSync animSync) : base(caster, animSync, Cooldown)
 {
 }
Example #11
0
 public virtual void Init()
 {
     motor = GetComponent <BaseMotor>();
 }
 public virtual void Construct()
 {
     motor = GetComponent<BaseMotor>();
 }
Example #13
0
 public BaseAbility(BaseMotor caster, AnimationSync animSync, float cooldown)
 {
     _caster   = caster;
     _animSync = animSync;
     _cooldown = cooldown;
 }
Example #14
0
 public AbilityBasicAttack(BaseMotor caster, AnimationSync animSync) : base(caster, animSync, Cooldown)
 {
 }