Monday, February 17, 2020

infinitives - When is "seems to be" used instead of "seems"?



  1. The baby seems happy/comfortable.

  2. The baby seems to be happy/comfortable.


Are these both correct? If both are correct, what are the differences between them?




Sunday, February 16, 2020

possessives - The name of the boy vs.The boy's name


Which one is correct or are both correct?



The boy's name is nice.
The name of the boy is nice.



I'm really confused these two sentences? Which one is more suitable?



Answer



"The name of the boy" and "the boy's name" are both grammatical, and in many contexts have the same meaning. But not all. ("The name of boy" is not grammatical).



In most contexts, even formal or literary ones, we would say "The boy's name" rather than "the name of the boy".


So "The boy's name is Michael" is quite normal, and "The name of the boy is Michael" is a bit unusual, but perfectly understandable and grammatical.


But, oddly, your example doesn't quite work: "The boy's name is nice" is fine, but "The name of the boy is nice" sounds very odd to me. I can't quite define why, I'm afraid: I just expect "The name of the boy is" to be followed by the name, and nothing else.


phrase usage - how to use "call on" phrasal verb


which one of those two sentences is correct



"The professor called on me for question 1"




or



"The professor called me on for question 1"





Saturday, February 15, 2020

phrase usage - How to “apologize for the inconvenience” customer and invite to restaurant again - in the most short way?



How to say apologize for the inconvenience customer and invite to restaurant again - in the most short way?


It looks that in English I should say that I am apologize (for something). So we apologize and invite again is invalid and should be we apologize for the inconvenience and invite again??? In Polish is not to be specific you just "apologize" not need to say "for what" it is optional


Consider such case - restaurant has some emergency and you want politely ask customer to come again?


How it will say native speaker in short (not what build long sentences but pass message).


What phrase will use he/she?




C# Design for Ability System


I'm a novice programmer but I have completed a pre-university in web prog so I am not a total noob. I'm using Unity, but this is just C# for now.



This is my first big project and I need some professional insight to make sure the design is not flawed. Currently working on abilities in an turn based rpg game.


What you might need to know: Abilities need to be learned/chosen, they may have requirements(levels, weapontype, more/etc.) New abilities will be added to the game with updates.


This is still the primitive stage, but very important to me because this project is more about learning to do it right rather than just getting it done.


Here are the following classes where we create abilities:


public abstract class Ability {
public readonly int id, multi, manaCost;

public Ability(int id, int multi, int manaCost) {
this.id = id;
this.multi = multi;

this.manaCost = manaCost;
}
public virtual void resolve(Actor user, Actor target){}
//Would create more methods with different parameters based on different abilities
//Example for multi target ability
public virtual void resolve(Actor user, Actor[] targets){}
}

Pretty simple stuff, Actor is just a in-game character. resolve is where the ability effects will be coded


using UnityEngine;

public class Freeze : Ability {
public Freeze() : base(0, 0, 3) { }

public override void resolve(Actor user, Actor target) {
int damage = 2 * user.attribute[2];
Debug.Log (damage);
target.damage(damage);

/*System.Random rnd = new System.Random();
if(rnd.Next(100) <= 35)

target.state = new Frozen();*/
}
}

the way I was planning to use abilities is, in the main script of the battle system there would be an array that has all the abilities such as this:


Ability[] all_ability;
public void createAbilities(){
all_ability = new Ability[2]; //size increased as we create more abilities
all_ability[0] = new Freeze();
all_ability[1] = new FirstStrike(); //and so on as we create more

}

The index of the array is also the id of the ability which allows us to easily access abilities.


So if an Actor wanted to use freeze, the id of freeze would be stored in Actor i.e. p1.actors[0].ability_ids array


so let's say i've got what ability the player chose, it would be something like this


int aId = p1.actors[i].ability_ids[j]; //would return 0 assuming he chose freeze
all_ability[aId].resolve(p1.actors[i], p2.actors[k]);

Everything works so far, no errors, and damage gets calculated correctly but this is a very simple ability and still much more to add like damage counters, animations, status effects etc.


What should I look out for? is there a much easier way to do this I dont know about? I guess my main concern is, as we learn in web programming, it is said to be very bad to hard code values and everything should come from databases, but, is that also true for a game since each ability can be quite different? As you can see, everything is hard coded here. I guess I just want tips on things I may have done wrong/if there is a clear better way to do this. Thanks for any and all replies!




Answer



You sound like you're off to a good start! However, you asked a pretty general question, so I can only really offer some general pointers that might help!


To start with, I'd use a List instead of an array ( using System.Collections.Generic). You can still do abilityList[index] like with arrays, but you get the added benefit of not having to handle resizing if you run out of rooms (since it's handled by the List class), and LINQ queries, if you're into that!


After that, you should make sure your Actor has an "AddAbilities" method. Then, on load (or creation), you can simply go down the list, adding the abilities appropriately (instead of hardcoding them). For instance, if your character load data for Darth Vader is:


Force Lightning, Force Choke


(Not knowing how you intend to store stuff, let's just assume you somehow parse out a list of strings)


foreach(string abil in savedCharAbilities)
{
//You can use reflection or an AbilityFactory that takes a string parameter to create
// an instnace of the class based on it's name.

// If you have an enumeration of all of the possible abilities
// (only do this if you have a small total amount!), you could set up a switch statement
// to get your new Ability instead.

character.AddAbility(createdAbility);
}

Finally, you may also want to look into making your abilities MonoBehaviors that implement an Ability Interface instead of inheriting from an abstract class - that way you can make use of Unity's built in Enable properties (for toggle-able abilties), it's Update method (for quickly changing effects), and Unity's Invoke call (which calls the passed method X seconds later, or every X seconds if you call InvokePeriodic).


grammar - "Stopped talking" and "stopped to talk"


picture of a practice exercise


In this exercise:




Ali stopped _____ to his friend. He talked to him then.
a) talk
b) talking (I chose this one)
c) to talk (This one is marked as the correct answer)
d) being talked



Why did they choose "to talk" as the right answer? And why not "talking"?


I understand the meanings of talk and stop so I don't understand why one is wrong and the other correct.




Friday, February 14, 2020

textures - Algorithm for approximating sihlouette image as polygon






Possible Duplicate:
Is there any heuristic to polygonize a closed 2D raster shape with n triangles?



I want to be able to analyze a texture in real time and approximate a polygon to represent a silhouette. Imagine a person standing in front of a green screen and I want to approximately trace around their outline and get a 2D polygon as the result. Are there algorithms to do this and are they fast enough to work frame-to-frame in a game?


(I have found algorithms to triangulate polygons, but I am having trouble knowing what to search for that describes my goal.)




Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...