public static bool SetHP(SActor actor, string Param1, string Param2, string Param3, string Param4)
        {
            var hp = int.Parse(Param1);

            actor.ResetHealth(hp, null);
            return(true);
        }
Пример #2
0
       static SActor Step(CharacterController controller, SActor current, Vector3 direction, float dt, bool moving)
    {
        SActor actor = current;
        float requested_speed;

        // if (running) 
        // {
        //     requested_speed = model.run_speed;
        // } else
        // {
        //    requested_speed = model.idle_speed; 
        // }
        if (moving) 
        {
            actor.speed = controller.velocity.magnitude;
        }
        else
        {
            actor.speed = 0;  
        }
         //Mathf.Lerp(actor.speed, requested_speed, model.responsiveness_speed); 
        actor.direction = direction; //Vector3.Lerp(actor.direction, direction, model.responsiveness_direction);

        actor.position = actor.position + actor.direction.normalized * actor.speed * dt;

        return actor;
    }
        public static bool addSpell(SActor actor, string Param1, string Param2, string Param3, string Param4)
        {
            var        spellId   = int.Parse(Param1);
            JSpellData spellData = ACDC.SpellData[spellId];

            actor.AddSpell(spellData, 0);
            return(true);
        }
        public static bool SetTrainDamage(SActor actor, string Param1, string Param2, string Param3, string Param4)
        {
            var ObjectDamage = int.Parse(Param1);
            var train_list   = World.Instance(actor.WorldId).GetGameObjects(GameObjectClassId.Train);

            foreach (var train in train_list)
            {
                ((STrain)train).mapData.jMapMovePathData[0].ObjectDamage = ObjectDamage;
            }
            return(true);
        }
        public static bool SetTrainPeriod(SActor actor, string Param1, string Param2, string Param3, string Param4)
        {
            var period     = float.Parse(Param1);
            var train_list = World.Instance(actor.WorldId).GetGameObjects(GameObjectClassId.Train);

            foreach (var train in train_list)
            {
                ((STrain)train).mapData.jMapMovePathData[0].createTime = period;
            }
            return(true);
        }
        public static bool getinfo(SActor actor, string Param1, string Param2, string Param3, string Param4)
        {
            var networkId  = int.Parse(Param1);
            var gameObject = NetworkManagerServer.Instance.GetGameObject(networkId, actor.WorldId);

            if (gameObject != null)
            {
                Log.Information($"DebugCommand networkID:{networkId}, gameObjectType:{(GameObjectClassId)gameObject.GetClassId()}");
            }
            return(true);
        }
        public static bool InsertItemIngame(SActor actor, string Param1, string Param2, string Param3, string Param4)
        {
            var item_id    = int.Parse(Param1);
            var item_count = int.Parse(Param2);

            for (int i = 0; i < item_count; ++i)
            {
                actor.GetItem(item_id);
            }

            return(true);
        }
        public static bool createAi(SActor actor, string Param1, string Param2, string Param3, string Param4)
        {
            byte   character_type = byte.Parse(Param1);
            string user_id        = Param2;
            byte   world_id       = byte.Parse(Param3);
            int    team           = int.Parse(Param4);

            AIController aiController = NetworkManagerServer.sInstance.CreateAI(character_type, user_id, world_id, System.Guid.NewGuid(), team, 0, -1, 1);

            aiController.OnStart();

            return(true);
        }
        public static bool end(SActor actor, string Param1, string Param2, string Param3, string Param4)
        {
            var otherTeam = World.Instance(actor.WorldId).GameMode.GetOtherTeam(actor.Team);

            if (Param1 == "win")
            {
                World.Instance(actor.WorldId).GameMode.EndGame(actor.Team, otherTeam, false, CloseType.Clear);
            }
            else if (Param1 == "lose")
            {
                World.Instance(actor.WorldId).GameMode.EndGame(otherTeam, actor.Team, false, CloseType.Clear);
            }

            return(true);
        }
Пример #10
0
    static void Predict(CharacterController controller, SActor actor, Vector3 direction, List<SActor> destination, bool moving, int steps)
    {
        float dt = 0.2f;

        destination.Clear();
        destination.Add(actor);

        List<SActor> predictions = new List<SActor>();

        for(int step = 0; step < steps; ++step)
        {
            actor = Step(controller, actor, direction, dt, moving);
            destination.Add(actor);
        }
    }
Пример #11
0
    static SActor Step(CharacterController controller, SActor current, Vector3 direction, float dt, bool moving, Transform cam)
    {
        SActor actor = current;
        float  requested_speed;

        if (moving)
        {
            actor.speed = controller.velocity.magnitude;
        }
        else
        {
            actor.speed = 0;
        }
        //Mathf.Lerp(actor.speed, requested_speed, model.responsiveness_speed);
        actor.direction = Vector3.Lerp(direction, cam.forward, 0.1f); //Vector3.Lerp(actor.direction, direction, model.responsiveness_direction);

        actor.position = actor.position + actor.direction.normalized * actor.speed * dt;

        return(actor);
    }
Пример #12
0
    void Update()
    {

        if (movementInput.magnitude >= 0.1f)
        {
            
            float targetAngle = Mathf.Atan2(movementInput.x, movementInput.z) * Mathf.Rad2Deg;
            transform.rotation = Quaternion.Euler(0f, targetAngle, 0f);

            controller.Move(movementInput * speed * Time.deltaTime);
            moving = true;
        }
        else 
        {
            moving = false;
        }

        Debug.Log(controller.velocity.magnitude);
        actor = Step(controller, actor, this.transform.forward, Time.deltaTime, moving);
        Predict(controller, actor, this.transform.forward, predictions, moving, steps);   
    }
Пример #13
0
    // Update is called once per frame
    void Update()
    {
        if (movementInput.magnitude >= 0.1f)
        {
            float targetAngle = Mathf.Atan2(movementInput.x, movementInput.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
            float angle       = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
            controller.Move(moveDir.normalized * speed * Time.deltaTime);

            moving = true;
            actor  = Step(controller, actor, moveDir, Time.deltaTime, moving, cam);
            Predict(controller, actor, moveDir, predictions, moving, steps, cam);
        }
        else
        {
            moving = false;
            actor  = Step(controller, actor, this.transform.forward, Time.deltaTime, moving, cam);
            Predict(controller, actor, this.transform.forward, predictions, moving, steps, cam);
        }
    }
Пример #14
0
 public static bool Execute(SActor actor, string Cmd, string Param1, string Param2, string Param3, string Param4)
 {
     return((bool)System.Reflection.Assembly.GetExecutingAssembly().GetType("Battle.DebugCommand").GetMethod(Cmd).Invoke(null, new object[] { actor, Param1, Param2, Param3, Param4 }));
 }
Пример #15
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="SActor"></param>
 public Role(SActor SActor)
 {
     Client_SActor = SActor;
     roleTempData  = new RoleTempData();
 }