示例#1
0
        public int FDoIdle(uint grfidlef)
        {
            var componentManager = _compMgr;

            if (componentManager == null)
            {
                return(0);
            }

            _libraryManager?.OnIdle(componentManager);
            OnIdle?.Invoke(this, new ComponentManagerEventArgs(componentManager));
            return(0);
        }
示例#2
0
        //-------------------------------------------------------------------------
        // ライフサイクル

        protected override void MyAwake()
        {
            // MainとGlowのSpriteオブジェクトを生成
            this.main = MyGameObject.Create <SpriteRenderer>("Main", CacheTransform);
            this.main.sortingOrder = Define.Layer.Order.Layer00;

            this.glow = MyGameObject.Create <SpriteRenderer>("Glow", CacheTransform);
            this.glow.sortingOrder = Define.Layer.Order.Layer00 + 1;

            this.op.SetMover(this);
            this.op.OnIdle = () => { OnIdle?.Invoke(this); };

            // デフォルトでFlashは無効
            this.op.DisableFlash();
        }
示例#3
0
 public override void OnTurn()
 {
     base.OnTurn();
     if (moving && !fighting)
     {
         Queue <Unit> queue;
         if (!Game.UnitPositionQueues.ContainsKey(blockingPos))
         {
             queue = new Queue <Unit>();
             Game.UnitPositionQueues[blockingPos] = queue;
         }
         else
         {
             queue = Game.UnitPositionQueues[blockingPos];
         }
         if (!queue.Contains(this))
         {
             queue.Enqueue(this);
         }
         if (Game.UnitBlockedPositions.Contains(blockingPos) || queue.Peek() != this)
         {
             OnIdle?.Invoke();
             idle = true;
             Game.UnitBlockedPositions.Add(blockingPos - areaRangeDelta);
             return;
         }
         if (idle)
         {
             Game.UnitBlockedPositions.Remove(blockingPos - areaRangeDelta);
         }
         Position += moveDelta;
         if (Position == blockingPos)
         {
             queue.Dequeue();
             blockingPos += areaRangeDelta;
         }
         if (Position == destination)
         {
             moving = false;
             OnReachDestination?.Invoke();
             if (Position == Game.Map.Bounds.LeftDown && Owner == Game.RightPlayer ||
                 Position == Game.Map.Bounds.RightDown && Owner == Game.LeftPlayer)
             {
                 Game.EndGame(Owner);
             }
         }
     }
 }
示例#4
0
 private void Session_Closed(object sender, EventArgs e)
 {
     OnIdle?.Invoke(instanceContext);
 }
示例#5
0
 protected virtual void OnIdleProc(System.EventArgs args)
 {
     OnIdle?.Invoke(this, args);
 }
    void FixedUpdate()
    {
        m_animation_speed = 1;
        float input_modifier = (m_input_x != 0.0f && m_input_y != 0.0f) ? 0.7071f : 1.0f;

        if (m_controllable)
        {
            m_input_x = GameEntry.Input.GetAxis(Constant.Input.HorizontalAxis);
            m_input_y = GameEntry.Input.GetAxis(Constant.Input.VerticalAxis);
        }

        if (m_input_s != 0)
        {
            m_input_x = m_input_s;
        }

        if (m_input_x != 0 && m_input_s == 0)
        {
            transform.Rotate(new Vector3(0, m_input_x * (turnSpeed / 2.0f), 0));
            m_rotation = m_input_x;
            m_input_x  = 0;
        }
        else
        {
            m_rotation = 0;
        }

        //if (m_input_x > 0)
        //{
        //    transform.localEulerAngles = new Vector3(0, 90, 0);
        //}
        //else if(m_input_x < 0)
        //{
        //    transform.localEulerAngles = new Vector3(0, -90, 0);
        //}
        //else
        //{
        //    transform.localEulerAngles = Vector3.zero;
        //}

        if (m_input_y < 0)
        {
            m_speed = backpedalSpeed;
        }
        else
        {
            m_speed = runSpeed;
        }

        if (clickToMove)
        {
            if (m_last_wanted_position != m_wanted_position)
            {
                float d = Vector3.Distance(transform.position, m_wanted_position);

                if (d > m_last_distance)
                {
                    d = 0;
                }
                else
                {
                    m_last_distance = d;
                }

                if (d >= 0.1f)
                {
                    transform.LookAt(new Vector3(m_wanted_position.x, transform.position.y, m_wanted_position.z));
                    m_input_y = Mathf.Clamp(d / 2f, 0, 1);
                }
                else
                {
                    m_last_wanted_position = m_wanted_position;
                    m_input_y = 0;
                }
            }
        }

        m_velocity = new Vector3(m_input_x * input_modifier, -antiBunny, m_input_y * input_modifier);
        //m_velocity = transform.TransformDirection(m_velocity);

        //m_move_speed = (transform.position - m_last_position).magnitude;
        //m_last_position = transform.position;

        if (Mathf.Abs(m_input_x) > 0.01f || Mathf.Abs(m_input_y) > 0.01f)
        {
            //m_velocity.y -= gravity*Time.deltaTime;
            //m_controller.Move(m_velocity*Time.deltaTime);
            OnMove?.Invoke(m_velocity * Time.deltaTime);
        }
        else
        {
            OnIdle?.Invoke();
        }
    }
示例#7
0
    public void ActOnTurn()
    {
        CanTakeAction      |= (Me == Player.Instance.Me);
        CanTakeBonusAction |= (Me == Player.Instance.Me);

        if (Stealth.IsHiding)
        {
            Stealth.Hide(); // re-up the Stealth CR for the round; TODO: account for obscurity at the new location, etc
        }

        if (Stealth.IsPerforming)
        {
            Stealth.Performance(); // re-up the Performance CR
        }

        Decider.ChooseState();

        switch (Decider.state)
        {
        case Decider.State.BadlyInjured:
            OnBadlyInjured?.Invoke();
            break;

        case Decider.State.Crafting:
            OnCrafting?.Invoke();
            break;

        case Decider.State.FriendsInNeed:
            OnFriendsInNeed?.Invoke();
            break;

        case Decider.State.FriendlyActorsSighted:
            OnFriendlyActorsSighted?.Invoke();
            break;

        case Decider.State.DamagedFriendlyStructuresSighted:
            OnDamagedFriendlyStructuresSighted?.Invoke();
            break;

        case Decider.State.FullLoad:
            OnFullLoad?.Invoke();
            break;

        case Decider.State.Harvesting:
            OnHarvesting?.Invoke();
            break;

        case Decider.State.HasObjective:
            OnHasObjective?.Invoke();
            break;

        case Decider.State.HostileActorsSighted:
            OnHostileActorsSighted?.Invoke();
            break;

        case Decider.State.HostileStructuresSighted:
            OnHostileStructuresSighted?.Invoke();
            break;

        case Decider.State.Idle:
            OnIdle?.Invoke();
            break;

        case Decider.State.InCombat:
            OnInCombat?.Invoke();
            break;

        case Decider.State.Medic:
            OnMedic?.Invoke();
            break;

        case Decider.State.MovingToGoal:
            OnMovingToGoal?.Invoke();
            break;

        case Decider.State.NeedsRest:
            OnNeedsRest?.Invoke();
            break;

        case Decider.State.ReachedGoal:
            OnReachedGoal?.Invoke();
            break;

        case Decider.State.Resting:
            OnResting?.Invoke();
            break;

        case Decider.State.UnderAttack:
            OnUnderAttack?.Invoke();
            break;

        case Decider.State.Watch:
            OnWatch?.Invoke();
            break;

        default:
            OnIdle?.Invoke();
            break;
        }
    }
示例#8
0
 private void OnSuperFail()
 {
     OnIdle?.Invoke(this);
 }
示例#9
0
 public static void RaiseOnIdle() => OnIdle?.Invoke();