Esempio n. 1
0
    // Use this for initialization
    protected override void Start()
    {
        base.Start();

        treated  = false;
        animator = GetComponent <Animator>();
        player   = GameObject.FindObjectOfType <PlayerController>();

        pieSize *= Screen.height;

        timer = new Timer(0.8f, Finish);

        indicatorObject = Entity.Spawn(this.gameObject, indicatorObject);
        indicator       = indicatorObject.GetComponent <TimeIndicator>();
        indicator.transform.position = indicator.transform.position + new Vector3(0, 0.95f, 0);
        indicator.Receiver           = timer.GetProgress;
        //indicator.color = new Color(113f / 255f, 238f / 255f, 244f / 255f);
        indicator.color = new Color(1, 1, 1, 0.8f);

        heart = Object.Instantiate(heart,
                                   new Vector3(transform.position.x + 0.25f, transform.position.y + 0.5f, transform.position.z),
                                   new Quaternion()) as GameObject;
        heart.transform.parent = transform.parent;
        heart.GetComponent <Renderer>().sortingOrder = short.MaxValue;
        heart.SetActive(false);

        ashes          = Entity.Spawn(gameObject, ashes);
        _ashController = ashes.GetComponent <Ashes>();
        ashes.SetActive(false);
    }
Esempio n. 2
0
 protected override void Start()
 {
     base.Start();
     //   clock = new Timer(1, Break);
     // clock.Stop();
     ashes          = Entity.Spawn(gameObject, ashes);
     _ashController = ashes.GetComponent <Ashes>();
     ashes.SetActive(false);
 }
Esempio n. 3
0
 static void Main(string[] args)
 {
     do
     {
         Console.Clear();
         int n;
         Console.Write("Enter n pls = ");
         int.TryParse(Console.ReadLine(), out n);
         Something[] arr = new Something[n];
         for (int i = 0; i < arr.Length; i++)
         {
             if (rnd.Next(0, 2) == 0)
             {
                 arr[i] = new Lentil();
             }
             else
             {
                 arr[i] = new Ashes();
             }
         }
         for (int i = 0; i < arr.Length; i++)
         {
             Console.WriteLine(arr[i]);
         }
         Console.WriteLine("------------------");
         Something[] lent = {};
         Something[] ash  = {};
         for (int i = 0; i < arr.Length; i++)
         {
             if (arr[i] is Lentil)
             {
                 Array.Resize(ref lent, lent.Length + 1);
                 lent[lent.Length - 1] = arr[i];
             }
             else
             {
                 Array.Resize(ref ash, ash.Length + 1);
                 ash[ash.Length - 1] = arr[i];
             }
         }
         Console.WriteLine("------------------");
         Console.WriteLine("lent");
         Console.WriteLine("------------------");
         for (int i = 0; i < lent.Length; i++)
         {
             Console.WriteLine(lent[i]);
         }
         Console.WriteLine("------------------");
         Console.WriteLine("ash");
         Console.WriteLine("------------------");
         for (int i = 0; i < ash.Length; i++)
         {
             Console.WriteLine(ash[i]);
         }
     } while (Console.ReadKey().Key != ConsoleKey.Escape);
 }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Something[] array = new Something[10];
            for (int i = 0; i < array.Length; ++i)
            {
                if (Something.rnd.Next(0, 2) == 0)
                {
                    array[i] = new Lentil();
                }
                else
                {
                    array[i] = new Ashes();
                }
                Console.WriteLine(array[i]);
            }
            List <Ashes>  ashes   = new List <Ashes>();
            List <Lentil> lentils = new List <Lentil>();

            for (int i = 0; i < array.Length; ++i)
            {
                if (array[i] is Lentil)
                {
                    lentils.Add(array[i] as Lentil);
                }
                else
                {
                    ashes.Add(array[i] as Ashes);
                }
            }
            foreach (var el in ashes)
            {
                Console.WriteLine(el);
            }

            Console.WriteLine();

            foreach (var el in lentils)
            {
                Console.WriteLine(el);
            }
        }
Esempio n. 5
0
    void Start()
    {
        timer           = new Timer(PLAYER_SPEED, CompleteMoving);
        timer.repeating = true;

        actionTimer = new Timer(PLAYER_SPEED, CompleteAction);

        var detector = FindObjectOfType <HandyDetector>();

        if (detector != null)
        {
            detector.defaultObject = transform;
        }

        previousPosition = player.position;

        animState = PlayerAnimState.Idle;

        canSwitch = true;
        canMove   = true;

        GroupManager.main.group["Running"].Add(this);
        GroupManager.main.group["Running"].Add(animator);
        //GroupManager.main.group["Running"].Add(this, new GroupDelegator(null, ()=>{canMove = true;}, null));
        GroupManager.main.group["To Level Over"].Add(this, new GroupDelegator(null, GoBackToIdle, null));
        GroupManager.main.group["To Level Over"].Add(animator);

        // not sure which one is better.
        GroupManager.main.group["Dialogue"].Add(this, new GroupDelegator(null, GoBackToIdle, null));
        GroupManager.main.group["Dialogue"].Add(animator);

        KeyboardController.Instance.KeyboardEventHandler = this;

        ashes          = Entity.Spawn(gameObject, ashes);
        _ashController = ashes.GetComponent <Ashes>();
        ashes.SetActive(false);

        IsAlive = true;
    }