示例#1
0
 public void placeActorAtPos(Actor_Data data, Vector3 pos)
 {
     setActorData(data);
     //_parentGO.transform.Translate(pos, Space.World);
     _parentGO.transform.position = pos;
     setActorActive(true);
 }
示例#2
0
    /*
     * public static bool trySoloBreed(Actor_Data actorA)
     * {
     *  //solo breeding by simulation will just flood the world with copies exponentially 1 -> 2 -> 4 -> 8
     *  Actor_BreedData A = actorA.breedData;
     *
     *  if (A.checkCanBreed() && A.gender == Actor_Gender.solo)
     *  {
     *      A.makePregnant();
     *      return true;
     *  }
     *  else return false;
     * }
     */

    public static bool tryBreed(Actor_Data actorA, Actor_Data actorB)
    {
        Actor_BreedData A = actorA.breedData;
        Actor_BreedData B = actorB.breedData;

        if (!(A.checkCanBreed() && B.checkCanBreed()))
        {
            return(false);
        }
        else if ((A.gender == Actor_Gender.female || A.gender == Actor_Gender.both) && B.gender == Actor_Gender.male)
        {
            A.makePregnant();
            B.makeCooldown();
            makeFamily(actorB, actorA);
            return(true);
        }
        else if ((B.gender == Actor_Gender.female || B.gender == Actor_Gender.both) && A.gender == Actor_Gender.male)
        {
            B.makePregnant();
            A.makeCooldown();
            makeFamily(actorA, actorB);
            return(true);
        }
        else if (B.gender == Actor_Gender.both && A.gender == Actor_Gender.both)
        {
            A.makePregnant();
            B.makePregnant();
            makeFamily(actorA, actorB);
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#3
0
    void Awake()
    {
        if (_actor == null)
        {
            _actor = this.GetComponent <Actor_Controller>();
        }
        _gameObject    = _actor.gameObject;
        _actor_Data    = _actor._ActorData;
        _transform     = _actor.gameObject.transform;
        _headTransfrom = _actor._Bone_Head;

        _rigidbody         = _actor.gameObject.GetComponent <Rigidbody>();
        _colliderCapsule   = _actor.gameObject.GetComponent <CapsuleCollider>();
        _colliderTransform = _colliderCapsule.transform;
        _colliderYbounds   = _colliderCapsule.bounds.extents.y; //bounding box distance from center to box
        _colliderCenter    = _colliderCapsule.center;



        _State_MovementSpeed  = State_MovementSpeed.walkSpeed;
        _State_Terrain        = State_Terrain.ground;
        _State_Sliding        = State_Sliding.notSliding;
        _State_Ragdoll        = State_IsRagdoll.notRagdolled;
        _State_Headspace      = State_Headspace.canStand;
        _State_LatchedSurface = State_LatchedSurface.noSurface;

        _remaining_Multijumps = _actor_Data._NumJumps;
    }
示例#4
0
 public void initByBreeding(Actor_Data parentA, Actor_Data parentB)
 {
     //TODO: init stats from two Actors
     //based on some actor breeding stat like:
     //- equal 50/50
     //- genetic dominance weighted
     //- random
     //- gene manipulation
 }
示例#5
0
 private void createActorData()
 {
     for (int i = 0; i < _maxActors; i++)
     {
         //the random data is generated in the Actor_Data Class itself!
         Actor_Data actor = new Actor_Data();
         moveActorToRegion(actor, actor.region); //generate region lists
     }
 }
示例#6
0
    public ChatterDelegate getChatter(Actor_Data actor)
    {
        _chatterDelegate = null;

        //TODO: check the actors personality
        //add some chatter functions to the delegate and return them

        _chatterDelegate += chatter_GlobalPolitics;
        _chatterDelegate += chatter_Family;

        return(_chatterDelegate);
    }
示例#7
0
 protected bool setActorData(Actor_Data data)
 {
     //if there is already some actor data then init should not do anything
     if (actorData != null)
     {
         Debug.LogWarning("Can not init Actor with Data, there already is data in this one!", this); return(false);
     }
     else
     {
         actorData = data;
         return(true);
     }
 }
示例#8
0
    public void killActor(Actor_CauseOfDeath cause, Actor_Data killerActor)
    {
        Alive = false;

        CauseOfDeath = cause;
        if (killerActor != null)
        {
            Killer = killerActor;
        }

        decayTime  = 0;
        deleteTime = 0;
    }
示例#9
0
    public static bool checkPersonalityCompability(Actor_Data actorA, Actor_Data actorB)
    {
        byte diff = (byte)Mathf.Abs(actorA.personalityData.Personality - actorB.personalityData.Personality);

        if (diff <= actorA.personalityData.PersonalityTollerance && diff <= actorB.personalityData.Personality)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#10
0
    // !!! Methods operating on a single ActorData go into ActorData itself!

    #region ActorData relationship Methods: e.g. with other Actors or Regions

    public void moveActorToRegion(Actor_Data actor, ushort regionID)
    {
        actor.region = regionID;                      //set actors current region

        if (actorDatasByRegion.ContainsKey(regionID)) //add to existing region list for fast access
        {
            actorDatasByRegion[regionID].Add(actor);
        }
        else //or create a new region list if the right one does not exist yet
        {
            actorDatasByRegion.Add(regionID, new List <Actor_Data> {
                actor
            });
        }
    }
示例#11
0
    private Player_Entity makePlayer(string name)
    {
        Actor_Data    data   = new Actor_Data(); //creates new random Actor_Data
        Actor_Entity  actor  = Actor_Manager.singleton.createActorEntity(name);
        Player_Entity player = new Player_Entity(actor);

        player.playerController = player.GO.AddComponent <Player_Controller>();

        player.actorController.actorData                  = data;
        player.actorController.actorData.name             = name;
        player.actorController.actorData.breedData.gender = Actor_Gender.male;
        player.actorController.actorData.ageInSecondsMax  = ulong.MaxValue - 1;
        player.actorController.actorData.essential        = true;

        //GameObject debugActorTMP = Instantiate((GameObject)Resources.Load("Debug/Debug_Actor"));
        //debugActorTMP.transform.SetParent(player.playerGO.gameObject.transform);

        player.GO.transform.position = new Vector3(Random.Range(10.0f, 20.0f), 0.0f, Random.Range(10.0f, 20.0f));

        DontDestroyOnLoad(player.GO);

        return(player);
    }
示例#12
0
 protected void releaseActorData()
 {
     actorData = null; //This should be OK as actorManager always holds a reference to all the Data
 }
示例#13
0
 public string chatter_Destination(Actor_Data actor)
 {
     return("I come from <Oldtown> and travel to <Newtown>.");
 }
示例#14
0
 public string chatter_GlobalPolitics(Actor_Data actor)
 {
     return("The <Kingdom of Elves> is in war with <Jan >.");
 }
示例#15
0
 public string chatter_LocalPolitics(Actor_Data actor)
 {
     return("The region <Western Forest> suffers <Famine>.");
 }
示例#16
0
 public string chatter_Relationship(Actor_Data actor)
 {
     return("Do you know <Buddy>? He is a <Farmer> in <Newtown>.");
 }
示例#17
0
 public string chatter_Job(Actor_Data actor)
 {
     return("I am a <Blacksmith> in <Oldtown>");
 }
示例#18
0
    //the player does something like player.chatter(actor){ChatterDelegate my = getChatter(actor); string chatter = ChatterDelegate(actor);}
    //this really looks more like a global helper function:  player.chatter(actor){Chatter_Manager.getChatterString();}


    //call these with delegates?
    //which one is added to the delegate depends on Actor personality
    public string chatter_Family(Actor_Data actor)
    {
        return("My <Husband> is <John>");
    }
示例#19
0
 private static void makeFamily(Actor_Data actorA, Actor_Data actorB)
 {
 }