public Container(InRange inRange, ContainerModule containerModule, ContainerUsefulness usefulness)
            {
                _inRange = inRange;

                Module     = containerModule;
                Usefulness = usefulness;
            }
Exemple #2
0
    //Hide an item
    IEnumerator HideItem(InRange item)
    {
        LevelSerializer.DontCollect();
        //Save the data
        var data = LevelSerializer.SerializeLevel(false, item.transform.GetComponent <UniqueIdentifier>().Id);

        yield return(new WaitForEndOfFrame());

        LevelSerializer.Collect();
        //Write it to a file
        var f = File.Create(Application.persistentDataPath + "/" + item.id + ".dat");

        f.Write(data, 0, data.Length);
        yield return(null);

        f.Close();
        yield return(new WaitForEndOfFrame());

        //Destroy the game object
        item.lastPosition = item.transform.position;
        Destroy(item.transform.gameObject);
        yield return(new WaitForEndOfFrame());

        item.transform  = null;
        item.inprogress = false;
    }
Exemple #3
0
    //Load an item
    IEnumerator ViewItem(InRange item)
    {
        //Check for the file
        if (!File.Exists(Application.persistentDataPath + "/" + item.id + ".dat"))
        {
            yield break;
        }
        yield return(new WaitForEndOfFrame());

        //Load the data
        var f = File.Open(Application.persistentDataPath + "/" + item.id + ".dat", FileMode.Open);
        var d = new byte[f.Length];

        f.Read(d, 0, (int)f.Length);
        f.Close();
        yield return(new WaitForEndOfFrame());

        //Deserialize it
        var         complete = false;
        LevelLoader loader   = null;

        LevelSerializer.DontCollect();
        LevelSerializer.LoadNow(d, true, false, (usedLevelLoader) => {
            complete = true;
            loader   = usedLevelLoader;
            LevelSerializer.Collect();
        });
        while (!complete)
        {
            yield return(null);
        }
        item.transform  = loader.Last.transform;
        item.inprogress = false;
    }
Exemple #4
0
 public WaypointStatus(
     Edge <Neighbor> FromEdge,
     double CurrentDistance,
     InRange WithInRange)
 {
     this.FromEdge        = FromEdge;
     this.CurrentDistance = CurrentDistance;
     this.WithInRange     = WithInRange;
 }
        public void Update(float dtime)
        {
            MotionSimulation.Step(dtime);
#if BETA_RELEASE
            ClientProfilers.NearestNeighbours.Start();
#endif
            inRangeAcc += dtime;
            if (inRangeAcc >= 0.4f)
            {
                if (Program.Settings.NearestNeighborsEnabled)
                {
                    InRange.Update();
                }
                inRangeAcc = 0;
            }
#if BETA_RELEASE
            ClientProfilers.NearestNeighbours.Stop();
            ClientProfilers.GameEntityUpdate.Start();
#endif
            foreach (var v in new List <Map.GameEntity>(objects))
            {
                v.GameUpdate(dtime);
            }
#if BETA_RELEASE
            ClientProfilers.GameEntityUpdate.Stop();
#endif
            UpdateActiveScripts(dtime);

#if SEE_THROUGH
            if (lastSeeThroughs != null)
            {
                foreach (var v in new List <Map.GameEntity>(lastSeeThroughs))
                {
                    ((Graphics.Content.MetaModel)v.MainGraphic).Opacity = 1;

                    /*((Graphics.Content.MetaModel)v.MainGraphic).Opacity += dtime;
                     * if (((Graphics.Content.MetaModel)v.MainGraphic).Opacity >= 1)
                     * {
                     *  lastSeeThroughs.Remove(v);
                     *  ((Graphics.Content.MetaModel)v.MainGraphic).HasAlpha = false;
                     * }*/
                }
            }
            var line = new Common.Bounding.Line(Game.Instance.Scene.Camera.Position, Game.Instance.Map.MainCharacter.Position);
            lastSeeThroughs = seeThroughables.Cull(line);
            foreach (var v in lastSeeThroughs)
            {
                ((Graphics.Content.MetaModel)v.MainGraphic).AlphaRef = 10;
                ((Graphics.Content.MetaModel)v.MainGraphic).Opacity  = 0.3f;

                /*((Graphics.Content.MetaModel)v.MainGraphic).HasAlpha = true;
                 * if(((Graphics.Content.MetaModel)v.MainGraphic).Opacity > 0.3f)
                 *  ((Graphics.Content.MetaModel)v.MainGraphic).Opacity -= dtime;*/
            }
#endif
        }
        /// <summary>
        /// Devices the arrived.
        /// </summary>
        /// <param name="sender">The sender.</param>
        private void DeviceArrived(ProximityDevice sender)
        {
            //if (sender == this.device)
            //{
            //    System.Diagnostics.Debug.WriteLine("Sender is the same NFC device.");
            //}

            //this.inRange.Invoke<INfcDevice>(this, new NfcDevice(sender));
            InRange.Invoke <INfcDevice>(this, this);
        }
        public ActionResult CalculateFizzBuzz(FizzBuzzModel fizzBuzzModel)
        {
            InRange inRange = new InRange();

            if (inRange.IsInRange(fizzBuzzModel.input))
            {
                StringList stringList = new StringList();
                fizzBuzzModel.result = stringList.NumList(fizzBuzzModel.input);
            }
            else
            {
                fizzBuzzModel.result = "The number was not in range, Please try again.";
            }

            return(View(fizzBuzzModel));
        }
    // Use this for initialization
    protected override void Start()
    {
        base.Start();

        stateMachine = new FSM();

        // Call Actions
        Intro();
        Wander();
        Chase();
        Attack();
        Evolve();

        stateMachine.Push(introState);

        previousTime = 0;

        refreshRateInSeconds = 1f;

        currentLimit = 0;
        threshold    = .75f;

        hurtBox        = GetComponent <CapsuleCollider>();
        pathfinder     = GetComponent <NavMeshAgent>();
        meleeWeapon    = GetComponentsInChildren <MeleeWeapon>();
        inRange        = GetComponentInChildren <InRange>();
        nemesisTrigger = GetComponent <NemesisTrigger>();

        pathfinder.speed = persona.speed;

        GetTarget();

        shield.SetActive(false);

        if (target != null)
        {
            transform.LookAt(target);
        }

        AIManager.instance.guiManager.SetBossEntity(this.GetComponent <Entity>());
    }
        static void Main(string[] args)
        {
            //создать делегат Incr,ссылающийся на лямбда-выражение,увеличивающее свой параметр на 2
            Incr incr = count => count + 2;

            //Incr incr = (int count) => count + 2; альтернативный способ объявления делегата
            //использование лямбда-выражение incr
            Console.WriteLine("Использование лямбда-выражения incr: ");
            int x = -10;

            while (x <= 0)
            {
                Console.Write(x + " ");
                x = incr(x); //увеличить значение x на 2
            }
            Console.WriteLine();
            //создать экземпляр делегата IsEven,ссылающийся на лямбда-выражение,возвращающее результат типа bool
            IsEven isEven = n => n % 2 == 0;

            //использование лямбда-выражение isEven
            Console.WriteLine("Использование лямбда-выражения isEven: ");
            for (int i = 1; i <= 10; i++)
            {
                if (isEven(i))
                {
                    Console.WriteLine(i + " чётное");
                }
            }
            //создать экземпляр делегата InRange,ссылающийся на лямбда-выражение,возвращающее результат типа bool
            InRange rangeOK = (low, high, val) => val >= low && val <= high;

            //использование лямбда-выражение rangeOK
            if (rangeOK(1, 5, 3))
            {
                Console.WriteLine("Число 3 находится в пределах от 1 до 5");
            }
        }
    public override bool Update()
    {
        GameObject goA = (GameObject)A.Value;
        GameObject goB = (GameObject)B.Value;

        if (goA == null)
        {
            EB.Debug.LogError("SequenceCondition_Distance: A is null");
            return(false);
        }

        if (goB == null)
        {
            EB.Debug.LogError("SequenceCondition_Distance: B is null");
            return(false);
        }

        var difference = goA.transform.position - goB.transform.position;

        if (OnlyXZ)
        {
            difference.y = 0;
        }

        float distance = difference.magnitude;

        if (distance <= Distance)
        {
            InRange.Invoke();
        }
        else
        {
            OutOfRange.Invoke();
        }
        return(false);
    }
Exemple #11
0
 /// <summary>
 ///     Creates the ndef message.
 /// </summary>
 /// <param name="e">The e.</param>
 /// <returns>NdefMessage.</returns>
 public NdefMessage CreateNdefMessage(NfcEvent e)
 {
     InRange.Invoke <INfcDevice>(this, this);
     return(new NdefMessage(_published.Values.ToArray()));
 }
Exemple #12
0
        public override List <Point> GetMoves()
        {
            //List of moves to be returned
            List <Point> moves = new List <Point>();


            //Iterator items
            Point curPoint;
            Piece curPiece;

            //Row and collumn of this piece
            int row = this.loc.X,
                col = this.loc.Y;

            //If stops[n] == true, stop going in a certain direction
            bool[] stops;

            //y-axis
            stops = new bool[2];
            for (int rMod = 1; rMod < 8; rMod++)
            {
                //if stop == 0, check positive direction
                //else, check negative direction
                for (int stop = 0; stop < 2; stop++)
                {
                    //if stops[stop] = true, don't check; stop
                    if (!stops[stop])
                    {
                        int dir = (stop == 0) ? 1 : -1;
                        curPoint = new Point(row + rMod * dir, col);
                        if (InRange.Invoke(curPoint))
                        {
                            curPiece = Chess.GetBoard().GetPiece(curPoint);
                            if (this.Beats(this, curPiece))
                            {
                                moves.Add(curPoint);
                                stops[stop] = (curPiece.GetColor() != ' ');
                            }
                            else
                            {
                                stops[stop] = true;
                            }
                        }
                        else
                        {
                            stops[stop] = true;
                        }
                    }
                }
            }
            //x-axis
            stops = new bool[2];
            for (int cMod = 1; cMod < 8; cMod++)
            {
                //if stop == 0, check positive direction
                //else, check negative direction
                for (int stop = 0; stop < 2; stop++)
                {
                    //if stops[stop] == 0, check positive direction
                    //else, check negative direction
                    if (!stops[stop])
                    {
                        int dir = (stop == 0) ? 1 : -1;
                        curPoint = new Point(row, col + cMod * dir);
                        if (InRange(curPoint))
                        {
                            curPiece = Chess.GetBoard().GetPiece(curPoint);
                            if (this.Beats(this, curPiece))
                            {
                                moves.Add(curPoint);
                                stops[stop] = (curPiece.GetColor() != ' ');
                            }
                            else
                            {
                                stops[stop] = true;
                            }
                        }
                        else
                        {
                            stops[stop] = true;
                        }
                    }
                }
            }
            return(moves);
        }
 internal void RaiseInRange()
 {
     InRange?.Invoke(this, new WiimoteRangeEventArgs(this, true));
 }
	//Load an item
	IEnumerator ViewItem(InRange item)
	{
		//Check for the file
		if(!File.Exists(Application.persistentDataPath + "/" + item.id + ".dat"))
		{
			yield break;
		}
		yield return new WaitForEndOfFrame();
		//Load the data
		var f = File.Open(Application.persistentDataPath + "/" + item.id + ".dat", FileMode.Open);
		var d = new byte[f.Length];
		f.Read(d, 0, (int)f.Length);
		f.Close();
		yield return new WaitForEndOfFrame();
		//Deserialize it
		var complete = false;
		LevelLoader loader = null;
		LevelSerializer.DontCollect();
		LevelSerializer.LoadNow(d, true, false, (usedLevelLoader)=>{
			complete = true;
			loader = usedLevelLoader;
			LevelSerializer.Collect();
		});
		while(!complete)
		{
			yield return null;
		}
		item.transform = loader.Last.transform;
		item.inprogress = false;

	}
	//Hide an item
	IEnumerator HideItem(InRange item)
	{
		LevelSerializer.DontCollect();
		//Save the data
		var data = LevelSerializer.SerializeLevel(false, item.transform.GetComponent<UniqueIdentifier>().Id);
		yield return new WaitForEndOfFrame();
		LevelSerializer.Collect();
		//Write it to a file
		var f = File.Create(Application.persistentDataPath + "/" + item.id + ".dat");
		f.Write(data,0,data.Length);
		yield return null;
		f.Close();
		yield return new WaitForEndOfFrame();
		//Destroy the game object
		item.lastPosition = item.transform.position;
		Destroy(item.transform.gameObject);
		yield return new WaitForEndOfFrame();
		item.transform = null;
		item.inprogress = false;
	}
Exemple #16
0
 private static void RaiseInRange(Wiimote wiimote)
 {
     Debug.WriteLine($"{wiimote} In Range");
     InRange?.Invoke(null, new WiimoteRangeEventArgs(wiimote, true));
     wiimote.RaiseInRange();
 }