예제 #1
0
    public int Eat(int x, int y, Mob myClass)
    {
        x = CheakPosX(x);
        y = CheakPosY(y);

        if (Map[x, y] == null)
        {
            return((int)TypeObject.Vacuum);
        }
        else if (Map[x, y].dead)
        {
            Map[x, y] = null;
            myClass.AddEnergy(23);
            return((int)TypeObject.Food);
        }
        else if (Map[x, y].myDna.RelationFriend(myClass.myDna))
        {
            if (myClass.colony)
            {
                //myClass.TransferEnergeIn(15);
            }
            else
            {
                myClass.AddEnergy(Map[x, y].GetDamage(20) - 5);
            }
            return((int)TypeObject.Friend);
        }
        else
        {
            //Debug.Log(enemy);
            myClass.AddEnergy(Map[x, y].GetDamage(20) - 5);
            return((int)TypeObject.Enemy);
        }
    }
예제 #2
0
    public void Photosintes(Mob myClass)
    {
        int   x          = myClass.x;
        int   y          = myClass.y;
        float dist       = Vector2.Distance(new Vector2((maxX - MINIMUMX) / 2, (maxY - MINIMUMY) / 2), new Vector2(x, y));
        float disttozero = Vector2.Distance(new Vector2((maxX - MINIMUMX) / 2, (maxY - MINIMUMY) / 2), new Vector2(MINIMUMX, MINIMUMY));

        myClass.AddEnergy(Mathf.RoundToInt(Mathf.Ceil(Mathf.Sin((disttozero - dist) / disttozero * Mathf.PI / 2) * 5f)));
    }