Пример #1
0
 void Start()
 {
     Debug.Log(unit.name + " moves with " + unit.movementSpeed);
     cam         = Camera.main;
     motor       = GetComponent <UnitMotor> ();
     motor.speed = unit.movementSpeed;
 }
 protected override void Awake()
 {
     motor           = GetComponent <UnitMotor>();
     healthSystem    = GetComponent <HealthSystem>();
     OnChangeHealth += healthSystem.UpdateHealthPointRander;
     base.Awake();
 }
 // Start is called before the first frame update
 void Start()
 {
     cam   = Camera.main;
     motor = GetComponent <UnitMotor>();
     // установка таргета для камеры
     cam.GetComponent <CameraController>().target = transform;
 }
Пример #4
0
        public Controllers()
        {
            IMotor motor = new UnitMotor(ServiceLocatorMonoBehaviour.GetService <CharacterController>());

            ServiceLocator.SetService(new TimeRemainingController());
            ServiceLocator.SetService(new PlayerController(motor));
            ServiceLocator.SetService(new FlashLightController());
            ServiceLocator.SetService(new InputController());
            ServiceLocator.SetService(new SelectionController());
            ServiceLocator.SetService(new WeaponController());
            ServiceLocator.SetService(new Inventory());
            ServiceLocator.SetService(new BotController());
            ServiceLocator.SetService(new PoolController());

            _executeControllers    = new IExecute[6];
            _executeControllers[0] = ServiceLocator.Resolve <TimeRemainingController>();
            _executeControllers[1] = ServiceLocator.Resolve <PlayerController>();
            _executeControllers[2] = ServiceLocator.Resolve <FlashLightController>();
            _executeControllers[3] = ServiceLocator.Resolve <InputController>();
            _executeControllers[4] = ServiceLocator.Resolve <SelectionController>();
            _executeControllers[5] = ServiceLocator.Resolve <BotController>();

            _fixedExecutesControllers    = new IFixedExecute[1];
            _fixedExecutesControllers[0] = ServiceLocator.Resolve <TimeRemainingController>();
        }
Пример #5
0
 protected override void Awake()
 {
     base.Awake();
     nameObject = "enemy";
     motor      = GetComponent <UnitMotor>();
     anim       = GetComponent <UnitAnimationController>();
     canAttack  = false;
 }
Пример #6
0
 protected override void Start()
 {
     base.Start();
     mInteraction = this.GetComponent <UnitInteraction>();
     mMotor       = this.GetComponent <UnitMotor>();
     mAttack      = this.GetComponent <UnitAttack>();
     mData        = this.GetComponent <UnitData>();
 }
Пример #7
0
 public void tst(UnitMotor um)
 {
     if (comingTo.ContainsKey(um))
     {
         comingTo[um].AddWorker(um);
         comingTo.Remove(um);
     }
     um.OnPathEnd -= tst;
 }
Пример #8
0
    protected override void OnAwake()
    {
        //Test
        UnitMotor um = GetComponent <UnitMotor>();

        if (um != null)
        {
            um.target = Vector3.zero;
        }
    }
Пример #9
0
 public void AddWorker(UnitMotor um)
 {
     if (workersCount < maxWorkersCount && !evacuating)
     {
         workersCount++;
         Destroy(um.gameObject);
     }
     else
     {
         SendToNextFabrique(um.GetComponent <UnitController>());
     }
 }
Пример #10
0
    // add new attacksystem here

    private void Start()
    {
        playerInput = unitSettings.IsPlayer ? new PlayerController() as IUnitInput: new SlimeController();

        jumpSystem = new JumpSystem();
        motor      = new UnitMotor(playerInput, jumpSystem, GetComponent <Rigidbody>(), unitSettings);

        if (cam != null)
        {
            playerCamInput = new PlayerController();
            camMotor       = new PlayerCamMotor(playerCamInput, GetComponent <Transform>(), cam, unitSettings);
        }
    }
Пример #11
0
    protected override void Awake()
    {
        Debug.Log("PlayerManager");
        //base.Awake();
        instance   = this;
        nameObject = "player";
        //LoadSaveSystem.instance.Defolt();
        health    = LoadSaveSystem.instance.LoadHealth();
        maxHealth = LoadSaveSystem.instance.LoadMaxHealth();
        damage    = LoadSaveSystem.instance.LoadDamage();

        motor = GetComponent <UnitMotor>();
        anim  = GetComponent <UnitAnimationController>();
        //OnChangeHealth += healthSystem.UpdateHealthPointRander;
    }
Пример #12
0
    protected override void OnDie()
    {
        EngineDelegate.instance.CreateEffect("Explode", this.transform.position, Quaternion.identity);
        CharacterController cc = GetComponent <CharacterController>();

        if (cc != null)
        {
            Destroy(cc);
        }
        UnitMotor um = GetComponent <UnitMotor>();

        if (um != null)
        {
            Destroy(um);
        }
        BoxCollider box = this.gameObject.AddComponent <BoxCollider>();

        box.size   = new Vector3(2.0f, 2.0f, 4.0f);
        box.center = new Vector3(0.0f, 2.0f, 0.0f);
        Rigidbody rb = this.gameObject.AddComponent <Rigidbody>();

        if (rb != null)
        {
            rb.useGravity      = true;
            rb.velocity        = new Vector3(0.0f, diedVelocity, 0.0f);
            rb.angularVelocity = new Vector3(0.0f, 0.0f, diedAngularVelocity);
        }

        DestroyOnTime dot = this.gameObject.AddComponent <DestroyOnTime>();

        if (dot != null)
        {
            dot.time = dieDisappearTime;
        }
        gameObject.layer = LayerMask.NameToLayer("UnhitableObject");

        foreach (Transform tran in transform)
        {
            if (tran.gameObject.renderer != null)
            {
                tran.gameObject.renderer.material.color = new Color(0.3f, 0.3f, 0.3f);
            }
        }
    }
Пример #13
0
 void drawUnitMotor(UnitMotor aUnit)
 {
     EditorGUILayout.BeginHorizontal();
         EditorGUILayout.Space();
         GUILayout.Label("Unit Motor Variables");
     EditorGUILayout.EndHorizontal();
     aUnit.unitAnimation = (Animation)EditorGUILayout.ObjectField("Animation", aUnit.unitAnimation, typeof(Animation), true);
     aUnit.movementSpeed = EditorGUILayout.FloatField("Movement Speed", aUnit.movementSpeed);
     aUnit.turnSpeed = EditorGUILayout.FloatField("Turn Speed", aUnit.turnSpeed);
     aUnit.jumpHeight = EditorGUILayout.FloatField("Jump Height", aUnit.jumpHeight);
     aUnit.maxVelocity = EditorGUILayout.FloatField("Max Velocity", aUnit.maxVelocity);
     aUnit.gravity = EditorGUILayout.FloatField("Gravity", aUnit.gravity);
     aUnit.relativeTransform = (Transform)EditorGUILayout.ObjectField("Relative Transform", aUnit.relativeTransform, typeof(Transform), true);
     aUnit.groundedDistanceCheck = EditorGUILayout.FloatField("Grounded Distance Check", aUnit.groundedDistanceCheck);
     aUnit.groundedRadiusSweep = EditorGUILayout.FloatField("Grounded Radius Sweep", aUnit.groundedRadiusSweep);
     aUnit.forwardAxis = EditorGUILayout.TextField("Forward Axis", aUnit.forwardAxis);
     aUnit.sideAxis = EditorGUILayout.TextField("Side Axis", aUnit.sideAxis);
     aUnit.jumpButton = EditorGUILayout.TextField("Jump Button", aUnit.jumpButton);
     aUnit.stanceKey = (KeyCode)EditorGUILayout.EnumPopup("Stance Key", aUnit.stanceKey);
     aUnit.useKey = (KeyCode)EditorGUILayout.EnumPopup("Use Key", aUnit.useKey);
 }
        public void Initialize()
        {
            var   resources  = Resources.Load <PlayerBehaviour>(AssetsPathGameObject.Object[GameObjectType.Character]);
            var   playerData = Data.PlayerData;
            var   obj        = Object.FindObjectOfType <PlayerBehaviour>().transform;
            IWalk character;

            //MyCharacter character = new MyCharacter(obj, playerData);
            if (obj.gameObject.TryGetComponent <Rigidbody>(out Rigidbody rgb))
            {
                character = new UnitMotor(obj, playerData);
            }
            else if (obj.gameObject.TryGetComponent <Rigidbody2D>(out Rigidbody2D rgb2d))
            {
                character = new UnitMotor2D(obj, playerData);
            }
            else
            {
                obj.gameObject.AddComponent <Rigidbody>();
                character = new UnitMotor(obj, playerData);
            }
            _context.MyCharacter = character;
        }
Пример #15
0
 /// <summary>
 /// Sets up the Unit. This will only be called once.
 /// </summary>
 protected void UnitSetup()
 {
     unitType = UnitType.Unit;
     CreateID();
     if (weapon != null)
     {
         _initialWeapon = weapon;
     }
     _maxHealth = health;
     if (renderer != null && outlineColor == Color.clear)
         outlineColor = renderer.material.GetColor("_OutlineColor");
     if (IsPlayer() || !movable)
         return;
     motor = gameObject.GetComponent<UnitMotor>();
     if (motor == null)
         motor = gameObject.AddComponent<UnitMotor>();
     motor.UpdateUnit(this);
     spawnPoint = Vector3.zero;
 }
Пример #16
0
 void Awake()
 {
     mWeapon = transform.Find("Weapon");
     mData   = GetComponent <UnitData>();
     mMotor  = GetComponent <UnitMotor>();
 }
Пример #17
0
 public virtual void OnPathEnd(UnitMotor um)
 {
     //print("pizda nahui");
 }
Пример #18
0
 // Use this for initialization
 //public NetworkIdentity netIdNiPo;
 //public bool hasAuth = false ;
 //PlayerObject po;
 void Start()
 {
     motor = GetComponent <UnitMotor>();
 }
Пример #19
0
 void Start()
 {
     cam   = Camera.main;
     motor = GetComponent <UnitMotor>();
     cam.GetComponent <CameraController>().target = transform;
 }
Пример #20
0
 private void Awake()
 {
     entity = true;
     motor  = GetComponent <UnitMotor>();
     focus  = null;
 }
Пример #21
0
 private void Start()
 {
     _cam   = Camera.main;
     _motor = GetComponent <UnitMotor>();
     _cam.GetComponent <CameraController>().Target = transform;
 }
Пример #22
0
 private void Awake()
 {
     motor = GetComponent <UnitMotor>();
 }