コード例 #1
0
ファイル: Enemy.cs プロジェクト: adamjoyce/slot-machine
    // Use this for initialization
    void Start () {
        ai = transform.GetChild(0).GetComponent<RAIN.Core.AIRig>().AI;
        nextFireball = 0;

        leftWall = GameObject.Find("Left Wall");
        rightWall= GameObject.Find("Right Wall");
        ceiling= GameObject.Find("Ceiling");
        floor = GameObject.Find("Floor");

        ai.WorkingMemory.SetItem("forceTurn", false);
        int randDirection = Random.Range(0, 2);
        if (randDirection == 0)
            randDirection = -1;
        if (!ai.WorkingMemory.ItemExists("direction"))
            ai.WorkingMemory.SetItem<float>("direction", randDirection);

        if (randDirection == -1)
        {
            ai.Senses.Sensors[1].AngleOffset = new Vector3(ai.Senses.Sensors[1].AngleOffset.x, -ai.Senses.Sensors[1].AngleOffset.y, ai.Senses.Sensors[1].AngleOffset.z);
        }

        var anim = GetComponent<Animator>();
        AnimatorStateInfo state = anim.GetCurrentAnimatorStateInfo(0);//could replace 0 by any other animation layer index
        anim.Play(state.fullPathHash, -1, Random.Range(0f, 1f));
    }
コード例 #2
0
ファイル: Enemy.cs プロジェクト: adamjoyce/slot-machine
    // Use this for initialization
    void Start()
    {
        ai           = transform.GetChild(0).GetComponent <RAIN.Core.AIRig>().AI;
        nextFireball = 0;

        leftWall  = GameObject.Find("Left Wall");
        rightWall = GameObject.Find("Right Wall");
        ceiling   = GameObject.Find("Ceiling");
        floor     = GameObject.Find("Floor");

        ai.WorkingMemory.SetItem("forceTurn", false);
        int randDirection = Random.Range(0, 2);

        if (randDirection == 0)
        {
            randDirection = -1;
        }
        if (!ai.WorkingMemory.ItemExists("direction"))
        {
            ai.WorkingMemory.SetItem <float>("direction", randDirection);
        }

        if (randDirection == -1)
        {
            ai.Senses.Sensors[1].AngleOffset = new Vector3(ai.Senses.Sensors[1].AngleOffset.x, -ai.Senses.Sensors[1].AngleOffset.y, ai.Senses.Sensors[1].AngleOffset.z);
        }

        var anim = GetComponent <Animator>();
        AnimatorStateInfo state = anim.GetCurrentAnimatorStateInfo(0);//could replace 0 by any other animation layer index

        anim.Play(state.fullPathHash, -1, Random.Range(0f, 1f));
    }
コード例 #3
0
ファイル: FireManLoadTruck.cs プロジェクト: chewingF/TheWay
    public override ActionResult Execute(RAIN.Core.AI ai)
    {
        if (_fireMan.IsTruckLoaded && _fireMan.FireTruck.Arrived)
        {
            _fireMan.UnloadTruck();

            return(ActionResult.SUCCESS);
        }

        return(ActionResult.RUNNING);
    }
コード例 #4
0
    public override ActionResult Execute(RAIN.Core.AI ai)
    {
        parentGO = ai.Body;
        //get the list of nav target of the IA
        WayPointStops = parentGO.GetComponent <HumanAI>().NavTargetsGO;
        Transform[] ts        = WayPointStops.GetComponentsInChildren <Transform>();
        int         randomInt = Random.Range(1, ts.Length - 1);

        rand = WayPointStops.transform.GetChild(randomInt).name;
        ai.WorkingMemory.SetItem <string>("target", rand);
        ai.WorkingMemory.SetItem("lock", true);
        base.Start(ai);

        return(ActionResult.SUCCESS);
    }
コード例 #5
0
 public ActionResult Execute(RAIN.Core.AI ai)
 {
     civil = ai.WorkingMemory.GetItem <RAINAspect>("moveTarget");
     //get the list of nav target of the IA
     state = civil.MountPoint.gameObject.GetComponent <Civilian>().GetState();
     if (state == EnumState.EStates.Panic.ToString())
     {
         ai.WorkingMemory.SetItem <bool>("targetPanic", true);
         ai.Motor.CloseEnoughDistance = 1;
     }
     else
     {
         ai.WorkingMemory.SetItem <bool>("targetPanic", false);
     }
     return(ActionResult.SUCCESS);
 }
コード例 #6
0
 public override ActionResult Execute(RAIN.Core.AI ai)
 {
     civil = ai.WorkingMemory.GetItem <RAINAspect>("moveTarget");
     //get the list of nav target of the IA
     if (civil != null)
     {
         state = civil.MountPoint.gameObject.GetComponent <Civilian>().GetState();
         if (state == EnumState.EStates.Panic.ToString() || state == EnumState.EStates.Run.ToString())
         {
             ai.WorkingMemory.SetItem <bool>("targetPanic", true);
         }
         else
         {
             ai.WorkingMemory.SetItem <bool>("targetPanic", false);
         }
     }
     else
     {
         ai.WorkingMemory.SetItem <bool>("targetPanic", false);
     }
     return(ActionResult.SUCCESS);
 }
コード例 #7
0
ファイル: Jump.cs プロジェクト: chewingF/TheWay
    public override ActionResult Execute(RAIN.Core.AI ai)
    {
        animator = GameObject.Find("Boss/Animator").GetComponent <Animator>();

        if (!animator)
        {
            return(ActionResult.FAILURE);
        }
        if (!JumpForce.IsValid)
        {
            return(ActionResult.FAILURE);
        }

        float     jumpForce = JumpForce.Evaluate <float>(ai.DeltaTime, ai.WorkingMemory);
        Transform t         = GameObject.Find("Boss").transform;

        if (t.position.y <= 3)
        {
            t.position = Vector3.Lerp(t.position, t.position + Vector3.up * jumpForce, 1f);
        }

        return(ActionResult.SUCCESS);
    }
コード例 #8
0
    public override void Start(RAIN.Core.AI ai)
    {
        _fireCommander = ai.GetCustomElement <FireCommanderElement>();

        _fireCommander.ClearTarget();
    }
コード例 #9
0
ファイル: FireManLoadTruck.cs プロジェクト: chewingF/TheWay
    public override void Start(RAIN.Core.AI ai)
    {
        _fireMan = ai.GetCustomElement <FireManElement>();

        _fireMan.LoadTruck();
    }