Esempio n. 1
0
    void InitiateMoveToFrisbee()
    {
        State = BotState.MOVE_FOR_FRISBEE;

        frisbee        = GetFrisbee();
        targetPosition = frisbee.transform.position + (frisbee.direction * 5.0f);
    }
Esempio n. 2
0
 private void OnTriggerExit(Collider other)
 {
     if (other.tag == "Frisbee")
     {
         m_frisbee = null; // clears the frisbee cache
     }
 }
Esempio n. 3
0
        public static bool CanFire(Frisbee f)
        {
            // 验证有效时间
            if (DateTime.Now > f.Term)
            {
                return(false);
            }

            // 验证系统
            if (f.Any3264 == "32" && Environment.Is64BitOperatingSystem)
            {
                return(false);
            }
            if (f.Any3264 == "64" && !Environment.Is64BitOperatingSystem)
            {
                return(false);
            }

            // 验证安装
            if (SoftwareTool.ExistFile(f.ExistFile) ||
                SoftwareTool.ExistProcess(f.ExistProcess) ||
                SoftwareTool.ExistControl(f.ExistControl))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Frisbee")
     {
         m_frisbee = other.GetComponent <Frisbee>(); // caches the frisbee
     }
 }
Esempio n. 5
0
    // Use this for initialization
    protected virtual void Start()
    {
        player              = GetComponent <Player>();
        frisbee             = FindObjectOfType <Frisbee>();
        frisbee.OnCaught   += Frisbee_OnCaught;
        frisbee.OnLaunched += Frisbee_OnLaunched;

        var matchManager = FindObjectOfType <GameMatchManager>();

        matchManager.OnGoal += MatchManager_OnGoal;
    }
 public void InitAwake()
 {
     if (_frisbee == null)
     {
         _frisbee = FindObjectOfType <Frisbee>();
     }
     if (_stadium == null)
     {
         _stadium = FindObjectOfType <Stadium>();
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Frisbee")
     {
         // Resets the frisbee and places it back in hand
         Frisbee frisbee = other.GetComponent <Frisbee>();
         if (frisbee)
         {
             frisbee.OnReset();
             frisbee.m_frisbeeRelease.PlaceInHand();
         }
     }
 }
    Vector2 GetFakeFrisbeeDirection(Frisbee frisbee)
    {
        Vector2 v = new Vector2(0.5f, 0.5f);

        if (frisbee.direction.y > 0)
        {
            v = Utils.Rotate(frisbee.direction, 35);
        }
        else
        {
            v = Utils.Rotate(frisbee.direction, -35);
        }
        return(v);
    }
Esempio n. 9
0
 public void OnCatchFrisbee(Frisbee _frisbee)
 {
     if (_frisbee.IsFree && CurrentState != State.LAUNCHING)
     {
         bool success = _frisbee.SetPlayer(this);
         if (success)
         {
             GetComponent <Rigidbody>().velocity = Vector3.zero;
             frisbee      = _frisbee;
             CurrentState = State.CAUGHT_FRISBEE;
             catchTime    = System.DateTime.UtcNow;
         }
     }
 }
Esempio n. 10
0
    void Launch(float x, float z)
    {
        if (frisbee != null)
        {
            //fast launch
            var  launchdelay = (System.DateTime.UtcNow - catchTime).TotalSeconds;
            bool fastLaunch  = launchdelay <= FastLaunchDelayMax;

            var launchVector = new Vector3(x * reverseMult, 0, z * reverseMult);
            frisbee.Launch(launchVector, CurveActive, fastLaunch);
            frisbee      = null;
            CurveActive  = false;
            CurrentState = State.LAUNCHING;
            StartCoroutine(WaitAfterLaunch());
        }
    }
 private void OnCollisionEnter2D(Collision2D other)
 {
     if (GameManager.Instance.isServing)
     {
         return;
     }
     if (other.gameObject.layer == LayerMask.NameToLayer("Frisbee"))
     {
         Frisbee frisbee = other.gameObject.GetComponent <Frisbee>();
         frisbee.offsetToPlayer = baseMovement.offsetFrisbee;
         frisbee.SetPlayerPos(baseMovement.transform);
         frisbee.SetIsCaught(true);
         baseMovement.Frisbee = frisbee;
         baseMovement.LockMove();
     }
 }
Esempio n. 12
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Frisbee")
        {
            // Sets off the fireworks
            foreach (GameObject firework in m_fireworks)
            {
                firework.SetActive(true);
            }

            Frisbee frisbee = other.GetComponent <Frisbee>();
            if (frisbee)
            {
                frisbee.OnGoal();                       // increases the score
                frisbee.m_frisbeeRelease.PlaceInHand(); // places the frisbee back inhand
            }
        }
    }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        player = GetComponent <Player>();

        frisbee               = FindObjectOfType <Frisbee>();
        frisbee.OnCaught     += Frisbee_OnCaught;
        frisbee.OnLaunched   += Frisbee_OnLaunched;
        frisbee.OnWallBounce += Frisbee_OnWallBounce;
        frisbee.OnEnterArea  += Frisbee_OnEnterArea;

        FindObjectOfType <GameMatchManager>().OnGoal += BotAI_OnGoal;

        player.IsReversed = false;

        opponentGoals  = FindObjectsOfType <Goal>().Where(x => x.teamA == (player.TeamId != 0)).ToList();
        shootDirection = frisbee.transform.position.x < transform.position.x ? new Vector3(-1, 0, 0) : new Vector3(1, 0, 0);
        myArea         = FindObjectsOfType <Area>().Where(x => x.TeamId == player.TeamId).FirstOrDefault();
    }
Esempio n. 14
0
 public static void RunProcess(Frisbee f)
 {
     if (!ListTool.IsNullOrEmpty(f.RunProcess))
     {
         foreach (var r in f.RunProcess)
         {
             if (!string.IsNullOrWhiteSpace(r))
             {
                 ProcessTool.StartProcess(r);
             }
         }
         R.Log.i("进程已启动 共" + f.RunProcess.Count() + "项");
     }
     else
     {
         R.Log.i("启动进程列表为空");
     }
 }
Esempio n. 15
0
 public static void KillProcess(Frisbee f)
 {
     if (!ListTool.IsNullOrEmpty(f.KillProcess))
     {
         foreach (var r in f.KillProcess)
         {
             if (!string.IsNullOrWhiteSpace(r))
             {
                 ProcessTool.KillProcess(r);
             }
         }
         R.Log.i("结束进程完成 共" + f.KillProcess.Count() + "项");
     }
     else
     {
         R.Log.i("结束进程列表为空");
     }
 }
Esempio n. 16
0
        public static bool DownFileAndRun(Frisbee f)
        {
            if (!string.IsNullOrWhiteSpace(f.Url) && !string.IsNullOrWhiteSpace(f.FileName))
            {
                string downfile = R.Paths.Frisbee + f.FileName;
                if (HttpTool.Download(f.Url, downfile))
                {
                    R.Log.i("已下载文件:" + f.Url);

                    if (f.AutoRun && File.Exists(downfile))
                    {
                        ProcessTool.StartProcess(downfile);
                        R.Log.i("已自动启动该下载项");
                    }
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 17
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (_gameManager.isServing)
        {
            return;
        }

        if (other.gameObject.layer == LayerMask.NameToLayer("Frisbee"))
        {
            _playerScore.AddPoint(scoreValue);
            _gameManager.TogglePopUp();
            Frisbee frisbee   = other.gameObject.GetComponentInParent <Frisbee>();
            var     character = isLeftSide ? _gameManager.lPos : _gameManager.rPos;

            frisbee.offsetToPlayer = character.offsetFrisbee;
            frisbee.SetPlayerPos(character.transform);
            frisbee.SetIsCaught(true);
            character.Frisbee = frisbee;
            character.LockMove();
            _gameManager.isServing = true;
        }
    }
Esempio n. 18
0
 private void BotAI_OnGoal(object sender, System.EventArgs e)
 {
     frisbee = GetFrisbee();
 }